File: parallel-2to3.patch

package info (click to toggle)
ipython 0.13.1-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,752 kB
  • sloc: python: 69,537; makefile: 355; lisp: 272; sh: 80; objc: 37
file content (24 lines) | stat: -rw-r--r-- 1,184 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
Description: allow running 2to3 in parallel
Author: Jakub Wilk
Forwarded: takowl@gmail.com

--- a/setup.py
+++ b/setup.py
@@ -264,6 +264,17 @@
                                   "ipython_win_post_install.py"}}
     
     if PY3:
+        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, num_processes=num_processes,
+                                                                                 doctests_only=doctests_only)
+            lib2to3.refactor.RefactoringTool = RefactoringTool
         setuptools_extra_args['use_2to3'] = True
         from setuptools.command.build_py import build_py
         setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}