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

Fix running 2to3.

--HG--
branch : distribute
extra : rebase_source : 2594ae17c6468d98288339c89cecd745f4dc181f
parent b712de5a
...@@ -6,6 +6,7 @@ from glob import glob ...@@ -6,6 +6,7 @@ from glob import glob
try: try:
from distutils.util import Mixin2to3 as _Mixin2to3 from distutils.util import Mixin2to3 as _Mixin2to3
# add support for converting doctests that is missing in 3.1 distutils # add support for converting doctests that is missing in 3.1 distutils
from distutils import log
from lib2to3.refactor import RefactoringTool, get_fixers_from_package from lib2to3.refactor import RefactoringTool, get_fixers_from_package
import setuptools import setuptools
class DistutilsRefactoringTool(RefactoringTool): class DistutilsRefactoringTool(RefactoringTool):
...@@ -21,15 +22,14 @@ try: ...@@ -21,15 +22,14 @@ try:
class Mixin2to3(_Mixin2to3): class Mixin2to3(_Mixin2to3):
def run_2to3(self, files): def run_2to3(self, files):
if not setuptools.run_2to3: if not setuptools.run_2to3:
return files return
files = _Mixin2to3.run_2to3(files) _Mixin2to3.run_2to3(self, files)
if setuptools.run_2to3_on_doctests: if setuptools.run_2to3_on_doctests:
fixer_names = self.fixer_names fixer_names = self.fixer_names
if fixer_names is None: if fixer_names is None:
fixer_names = get_fixers_from_package('lib2to3.fixes') fixer_names = get_fixers_from_package('lib2to3.fixes')
r = DistutilsRefactoringTool(fixer_names) r = DistutilsRefactoringTool(fixer_names)
r.refactor(files, write=True, doctests_only=True) r.refactor(files, write=True, doctests_only=True)
return files
except ImportError: except ImportError:
class Mixin2to3: class Mixin2to3:
......
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