Description: run 2to3 in parallel
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Last-Update: 2012-12-18

--- a/setup.py
+++ b/setup.py
@@ -158,6 +158,23 @@
 
     cmdclass['compile_catalog'] = compile_catalog_plusjs
 
+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, doctests_only=False):
+                return lib2to3.refactor.MultiprocessRefactoringTool.refactor(
+                    self, items,
+                    write=write,
+                    doctests_only=doctests_only,
+                    num_processes=num_processes
+                )
+        lib2to3.refactor.RefactoringTool = RefactoringTool
 
 setup(
     name='Sphinx',
