Commit 536c9838 authored by Martin v. Löwis's avatar Martin v. Löwis

Provide registry for fixer packages.

--HG--
branch : distribute
extra : rebase_source : 6a1259914751bdc18a32b98bd87680fb5fe94e70
parent f5adca61
......@@ -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'
......
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment