From 536c9838f3bd703c97b3816bb8b723e41cec7d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 13 Sep 2009 10:19:07 +0200 Subject: Provide registry for fixer packages. --HG-- branch : distribute extra : rebase_source : 6a1259914751bdc18a32b98bd87680fb5fe94e70 --- setuptools/__init__.py | 2 ++ setuptools/command/build_py.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'setuptools') 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: -- cgit v1.2.3