diff options
Diffstat (limited to 'Lib/lib2to3/main.py')
-rw-r--r-- | Lib/lib2to3/main.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py index d37fe9e..084fc0c 100644 --- a/Lib/lib2to3/main.py +++ b/Lib/lib2to3/main.py @@ -10,8 +10,7 @@ import optparse from . import refactor - -class StdoutRefactoringTool(refactor.RefactoringTool): +class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): """ Prints output to stdout. """ @@ -64,6 +63,8 @@ def main(fixer_pkg, args=None): help="Fix up doctests only") parser.add_option("-f", "--fix", action="append", default=[], help="Each FIX specifies a transformation; default: all") + parser.add_option("-j", "--processes", action="store", default=1, + type="int", help="Run 2to3 concurrently") parser.add_option("-x", "--nofix", action="append", default=[], help="Prevent a fixer from being run.") parser.add_option("-l", "--list-fixes", action="store_true", @@ -126,7 +127,14 @@ def main(fixer_pkg, args=None): if refactor_stdin: rt.refactor_stdin() else: - rt.refactor(args, options.write, options.doctests_only) + try: + rt.refactor(args, options.write, options.doctests_only, + options.processes) + except refactor.MultiprocessingUnsupported: + assert options.processes > 1 + print >> sys.stderr, "Sorry, -j isn't " \ + "supported on this platform." + return 1 rt.summarize() # Return error status (0 if rt.errors is zero) |