diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-03-22 00:35:10 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-03-22 00:35:10 (GMT) |
commit | 73a22f0500ce713d46fce864e95402c34a45afd9 (patch) | |
tree | ef47a88b0116333b8941143b09607b84e7f233f5 /Lib/distutils | |
parent | 3faa84f18e2a340c2a805a343f3b10a05dfe5fdd (diff) | |
download | cpython-73a22f0500ce713d46fce864e95402c34a45afd9.zip cpython-73a22f0500ce713d46fce864e95402c34a45afd9.tar.gz cpython-73a22f0500ce713d46fce864e95402c34a45afd9.tar.bz2 |
Add build_py_2to3.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/build_py.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py index 63ced4b..f39ffb8 100644 --- a/Lib/distutils/command/build_py.py +++ b/Lib/distutils/command/build_py.py @@ -383,3 +383,27 @@ class build_py (Command): if self.optimize > 0: byte_compile(files, optimize=self.optimize, force=self.force, prefix=prefix, dry_run=self.dry_run) + +class build_py_2to3(build_py): + def run(self): + from lib2to3.refactor import RefactoringTool + self.updated_files = [] + build_py.run(self) + class Options: + pass + o = Options() + o.doctests_only = False + o.fix = [] + o.list_fixes = [] + o.print_function = False + o.verbose = False + o.write = True + r = RefactoringTool(o) + r.refactor_args(self.updated_files) + + def build_module(self, module, module_file, package): + res = build_py.build_module(self, module, module_file, package) + if res[1]: + # file was copied + self.updated_files.append(res[0]) + return res |