summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/util.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2012-02-09 20:37:14 (GMT)
committerÉric Araujo <merwok@netwok.org>2012-02-09 20:37:14 (GMT)
commit692a49394dd871bf73418f018fd215678dc67e25 (patch)
tree20428602a7158430794f755ad60fa107bb5a4d05 /Lib/packaging/util.py
parent1a765f5d9d3603b9d2d1415fcc8433c5f5e9e6e1 (diff)
downloadcpython-692a49394dd871bf73418f018fd215678dc67e25.zip
cpython-692a49394dd871bf73418f018fd215678dc67e25.tar.gz
cpython-692a49394dd871bf73418f018fd215678dc67e25.tar.bz2
Start improving 2to3 code in packaging (#13462).
- Change the fixers used in tests to something not provided by lib2to3 - Test conversion of doctests in text files - Factor out test boilerplate into a common method
Diffstat (limited to 'Lib/packaging/util.py')
-rw-r--r--Lib/packaging/util.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py
index fff919c..a1f6782 100644
--- a/Lib/packaging/util.py
+++ b/Lib/packaging/util.py
@@ -853,13 +853,11 @@ def run_2to3(files, doctests_only=False, fixer_names=None,
# Make this class local, to delay import of 2to3
from lib2to3.refactor import get_fixers_from_package, RefactoringTool
- fixers = []
fixers = get_fixers_from_package('lib2to3.fixes')
if fixer_names:
for fixername in fixer_names:
- fixers.extend(fixer for fixer in
- get_fixers_from_package(fixername))
+ fixers.extend(get_fixers_from_package(fixername))
r = RefactoringTool(fixers, options=options)
r.refactor(files, write=True, doctests_only=doctests_only)
@@ -870,21 +868,23 @@ class Mixin2to3:
the class variables, or inherit from this class
to override how 2to3 is invoked.
"""
- # provide list of fixers to run.
- # defaults to all from lib2to3.fixers
+ # list of fixers to run; defaults to all implicit from lib2to3.fixers
fixer_names = None
-
- # options dictionary
+ # dict of options
options = None
-
- # list of fixers to invoke even though they are marked as explicit
+ # list of extra fixers to invoke
explicit = None
+ # TODO need a better way to add just one fixer from a package
+ # TODO need a way to exclude individual fixers
def run_2to3(self, files, doctests_only=False):
""" Issues a call to util.run_2to3. """
return run_2to3(files, doctests_only, self.fixer_names,
self.options, self.explicit)
+ # TODO provide initialize/finalize_options
+
+
RICH_GLOB = re.compile(r'\{([^}]*)\}')
_CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]')
_CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$')