File: parallel-2to3.diff

package info (click to toggle)
python-docutils 0.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,108 kB
  • ctags: 7,367
  • sloc: python: 41,778; lisp: 8,644; sh: 164; makefile: 148; xml: 34
file content (26 lines) | stat: -rw-r--r-- 953 bytes parent folder | 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.