@@ -69,6 +69,12 @@ namespace mob {
6969 return *this ;
7070 }
7171
72+ pip& pip::index (const std::string& s)
73+ {
74+ index_ = s;
75+ return *this ;
76+ }
77+
7278 pip& pip::no_dependencies ()
7379 {
7480 no_deps_ = true ;
@@ -147,6 +153,10 @@ namespace mob {
147153 .arg (" --no-warn-script-location" )
148154 .arg (" --disable-pip-version-check" );
149155
156+ if (!index_.empty ()) {
157+ p.arg (" -i" , index_).arg (" --extra-index-url" , " https://pypi.org/simple" )
158+ }
159+
150160 if (!package_.empty ()) {
151161 if (version_.empty ()) {
152162 p.arg (package_);
@@ -169,19 +179,26 @@ namespace mob {
169179
170180 void pip::do_download ()
171181 {
172- execute_and_join (process ()
173- .binary (tasks::python::python_exe ())
174- .chcp (65001 )
175- .stdout_encoding (encodings::utf8)
176- .stderr_encoding (encodings::utf8)
177- .arg (" -X" , " utf8" )
178- .arg (" -m" , " pip" )
179- .arg (" download" )
180- .arg (" --no-binary=:all:" )
181- .arg (" --no-deps" )
182- .arg (" -d" , conf ().path ().cache ())
183- .arg (package_ + " ==" + version_)
184- .env (this_env::get ().set (" PYTHONUTF8" , " 1" )));
182+ auto p = process ()
183+ .binary (tasks::python::python_exe ())
184+ .chcp (65001 )
185+ .stdout_encoding (encodings::utf8)
186+ .stderr_encoding (encodings::utf8)
187+ .arg (" -X" , " utf8" )
188+ .arg (" -m" , " pip" )
189+ .arg (" download" );
190+
191+ if (!index_.empty ()) {
192+ p.arg (" -i" , index_).arg (" --extra-index-url" , " https://pypi.org/simple" )
193+ }
194+
195+ p.arg (" --no-binary=:all:" )
196+ .arg (" --no-deps" )
197+ .arg (" -d" , conf ().path ().cache ())
198+ .arg (package_ + " ==" + version_)
199+ .env (this_env::get ().set (" PYTHONUTF8" , " 1" ));
200+
201+ execute_and_join (p);
185202 }
186203
187204} // namespace mob
0 commit comments