1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
From 71f36957f858eefd3d1fa158397e794dc608365e Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@debian.org>
Date: Thu, 8 Oct 2015 11:57:07 -0700
Subject: run 2to3 in parallel
Forwarded: not-needed
Last-Update: 2012-05-12
Patch-Name: parallel-2to3.diff
---
setup.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/setup.py b/setup.py
index 97ec659..118bec1 100755
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,18 @@ except ImportError:
if sys.version_info >= (3,):
+
+ num_processes = 1
+ for option in os.environ.get('DEB_BUILD_OPTIONS', '').split():
+ if option.startswith('parallel='):
+ num_processes = int(option.split('=', 1)[1])
+ if num_processes > 1:
+ import lib2to3.refactor
+ class RefactoringTool(lib2to3.refactor.MultiprocessRefactoringTool):
+ def refactor(self, items, write=False):
+ return lib2to3.refactor.MultiprocessRefactoringTool.refactor(self, items, write=write, num_processes=num_processes)
+ lib2to3.refactor.RefactoringTool = RefactoringTool
+
# copy-convert auxiliary python sources
class copy_build_py_2to3(build_py_2to3):
"""Copy/convert Python source files in given directories recursively.
|