File: parallel-2to3.diff

package info (click to toggle)
python-docutils 0.13.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,728 kB
  • ctags: 7,259
  • sloc: python: 43,776; lisp: 13,142; xml: 1,644; sh: 164; makefile: 151
file content (36 lines) | stat: -rw-r--r-- 1,237 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
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.