Package: python-docutils / 0.12+dfsg-1

parallel-2to3.diff Patch series | download
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
Description: run 2to3 in parallel
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Last-Update: 2012-05-12

--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,18 @@
 
 
 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.