@@ -155,6 +155,28 @@ def install_pkg(pkg_spec, install_path):
155
155
f1 .close ()
156
156
return meta
157
157
158
+ def install (to_install , install_path ):
159
+ # sets would be perfect here, but don't depend on them
160
+ installed = []
161
+ try :
162
+ while to_install :
163
+ if debug :
164
+ print ("Queue:" , to_install )
165
+ pkg_spec = to_install .pop (0 )
166
+ if pkg_spec in installed :
167
+ continue
168
+ meta = install_pkg (pkg_spec , install_path )
169
+ installed .append (pkg_spec )
170
+ if debug :
171
+ print (meta )
172
+ deps = meta .get ("deps" , "" ).rstrip ()
173
+ if deps :
174
+ deps = deps .decode ("utf-8" ).split ("\n " )
175
+ to_install .extend (deps )
176
+ except NotFoundError :
177
+ print ("Error: cannot find '%s' package (or server error), packages may be partially installed" \
178
+ % pkg_spec , file = sys .stderr )
179
+
158
180
def cleanup ():
159
181
for fname in cleanup_files :
160
182
try :
@@ -224,26 +246,7 @@ def main():
224
246
if not to_install :
225
247
help ()
226
248
227
- # sets would be perfect here, but don't depend on them
228
- installed = []
229
- try :
230
- while to_install :
231
- if debug :
232
- print ("Queue:" , to_install )
233
- pkg_spec = to_install .pop (0 )
234
- if pkg_spec in installed :
235
- continue
236
- meta = install_pkg (pkg_spec , install_path )
237
- installed .append (pkg_spec )
238
- if debug :
239
- print (meta )
240
- deps = meta .get ("deps" , "" ).rstrip ()
241
- if deps :
242
- deps = deps .decode ("utf-8" ).split ("\n " )
243
- to_install .extend (deps )
244
- except NotFoundError :
245
- print ("Error: cannot find '%s' package (or server error), packages may be partially installed" \
246
- % pkg_spec , file = sys .stderr )
249
+ install (to_install , install_path )
247
250
248
251
if not debug :
249
252
cleanup ()
0 commit comments