@@ -252,13 +252,26 @@ def add_dateutil():
252252 mod .extra_compile_args .append ('-DVERBOSE' )
253253
254254if sys .version_info [0 ] >= 3 :
255- # We need to skip certain files that have already been
256- # converted to Python 3.x
255+ import multiprocessing
256+ from distutils import util
257+ def parallel_refactor (x ):
258+ from lib2to3 .refactor import RefactoringTool , get_fixers_from_package
259+ class DistutilsRefactoringTool (RefactoringTool ):
260+ def ignore (self , msg , * args , ** kw ):
261+ pass
262+ log_error = log_message = log_debug = ignore
263+ fixer_names = get_fixers_from_package ('lib2to3.fixes' )
264+ r = DistutilsRefactoringTool (fixer_names , options = None )
265+ r .refactor ([x ], write = True )
266+
257267 original_build_py = build_py
258268 class build_py (original_build_py ):
259269 def run_2to3 (self , files ):
270+ # We need to skip certain files that have already been
271+ # converted to Python 3.x
260272 filtered = [x for x in files if 'py3' not in x ]
261- original_build_py .run_2to3 (self , filtered )
273+ p = multiprocessing .Pool ()
274+ p .map (parallel_refactor , filtered )
262275
263276print_raw ("pymods %s" % py_modules )
264277print_raw ("packages %s" % packages )
0 commit comments