summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/lib2to3/refactor.py8
-rwxr-xr-xTools/scripts/2to34
2 files changed, 8 insertions, 4 deletions
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
index af0b3a8..e4bc2e8 100755
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -172,9 +172,11 @@ class RefactoringTool(object):
want a pre-order AST traversal, and post_order is the list that want
post-order traversal.
"""
- fixer_pkg = self.fixer_dir.replace(os.path.sep, ".")
- if os.path.altsep:
- fixer_pkg = fixer_pkg.replace(os.path.altsep, ".")
+ if os.path.isabs(self.fixer_dir):
+ fixer_pkg = os.path.relpath(self.fixer_dir, os.path.join(os.path.dirname(__file__), '..'))
+ else:
+ fixer_pkg = self.fixer_dir
+ fixer_pkg = fixer_pkg.replace(os.path.sep, ".")
pre_order_fixers = []
post_order_fixers = []
fix_names = self.options.fix
diff --git a/Tools/scripts/2to3 b/Tools/scripts/2to3
index 7578d9d..4fd2cf8 100755
--- a/Tools/scripts/2to3
+++ b/Tools/scripts/2to3
@@ -1,5 +1,7 @@
#!/usr/bin/env python
from lib2to3 import refactor
import sys
+import os
-sys.exit(refactor.main("lib2to3/fixes"))
+fixers = os.path.join(os.path.dirname(refactor.__file__), "fixes")
+sys.exit(refactor.main(fixers))