diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2009-09-13 10:19:07 +0200 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2009-09-13 10:19:07 +0200 |
commit | 536c9838f3bd703c97b3816bb8b723e41cec7d9a (patch) | |
tree | 3c3b1c9a6c61260cec26263a26c46d8ade7303c3 | |
parent | f5adca61c9cb6797eaf9da2029c9132ec486b552 (diff) | |
download | external_python_setuptools-536c9838f3bd703c97b3816bb8b723e41cec7d9a.tar.gz external_python_setuptools-536c9838f3bd703c97b3816bb8b723e41cec7d9a.tar.bz2 external_python_setuptools-536c9838f3bd703c97b3816bb8b723e41cec7d9a.zip |
Provide registry for fixer packages.
--HG--
branch : distribute
extra : rebase_source : 6a1259914751bdc18a32b98bd87680fb5fe94e70
-rw-r--r-- | setuptools/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/command/build_py.py | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 05b65e4d..8c3eeb6d 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -31,6 +31,8 @@ run_2to3 = False # If we run 2to3 on .py files, should we also convert docstrings? # Default: yes; assume that we can detect doctests reliably run_2to3_on_doctests = True +# Package names for fixer packages +lib2to3_fixer_packages = ['lib2to3.fixes'] def find_packages(where='.', exclude=()): """Return a list all Python packages found within directory 'where' diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index d5890afe..b570ddb5 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -23,12 +23,13 @@ try: def run_2to3(self, files): if not setuptools.run_2to3: return + if not self.fixer_names: + self.fixer_names = [] + for p in setuptools.lib2to3_fixer_packages: + self.fixer_names.extend(get_fixers_from_package(p)) _Mixin2to3.run_2to3(self, files) if setuptools.run_2to3_on_doctests: - fixer_names = self.fixer_names - if fixer_names is None: - fixer_names = get_fixers_from_package('lib2to3.fixes') - r = DistutilsRefactoringTool(fixer_names) + r = DistutilsRefactoringTool(self.fixer_names) r.refactor(files, write=True, doctests_only=True) except ImportError: |