@@ -299,13 +299,27 @@ def run_2to3(self, files):
299
299
filtered = [x for x in files if should_2to3 (x , self .build_lib )]
300
300
if sys .platform .startswith ('win' ) or 'TRAVIS' in os .environ :
301
301
# doing this in parallel on windows may crash your computer
302
- [ refactor ( f ) for f in filtered ]
302
+ self . run_2to3_uniprocess ( filtered )
303
303
else :
304
+ self .run_2to3_multiprocess (filtered )
305
+ print ()
306
+
307
+ def run_2to3_uniprocess (self , files ):
308
+ for i , f in enumerate (files ):
309
+ print ("Running 2to3... %.02f%%" %
310
+ (float (i ) / len (files ) * 100.0 ), end = '\r ' )
311
+ refactor (f )
312
+
313
+ def run_2to3_multiprocess (self , files ):
314
+ try :
304
315
p = multiprocessing .Pool ()
305
- for i , x in enumerate (p .imap_unordered (refactor , filtered )):
316
+ except :
317
+ self .run_2to3_uniprocess (files )
318
+ else :
319
+ for i , x in enumerate (p .imap_unordered (refactor , files )):
306
320
print ("Running 2to3... %.02f%%" %
307
- (float (i ) / len (filtered ) * 100.0 ), end = '\r ' )
308
- print ()
321
+ (float (i ) / len (files ) * 100.0 ), end = '\r ' )
322
+
309
323
310
324
print_raw ("pymods %s" % py_modules )
311
325
print_raw ("packages %s" % packages )
0 commit comments