[Python-checkins] distutils2: 2to3 conversion functionality added in build_script
tarek.ziade
python-checkins at python.org
Thu Aug 19 08:34:14 CEST 2010
tarek.ziade pushed 4b7b258a25db to distutils2:
http://hg.python.org/distutils2/rev/4b7b258a25db
changeset: 575:4b7b258a25db
user: Zubin Mithra <zubin.mithra at gmail.com>
date: Fri Aug 13 20:16:57 2010 +0530
summary: 2to3 conversion functionality added in build_script
files: src/distutils2/command/build_py.py, src/distutils2/command/build_scripts.py
diff --git a/src/distutils2/command/build_py.py b/src/distutils2/command/build_py.py
--- a/src/distutils2/command/build_py.py
+++ b/src/distutils2/command/build_py.py
@@ -114,7 +114,7 @@
if self.use_2to3 and self._updated_files:
self.run_2to3(self._updated_files, self._doctests_2to3,
- self.distribution.use_2to3_fixers)
+ self.use_2to3_fixers)
self.byte_compile(self.get_outputs(include_bytecode=0))
diff --git a/src/distutils2/command/build_scripts.py b/src/distutils2/command/build_scripts.py
--- a/src/distutils2/command/build_scripts.py
+++ b/src/distutils2/command/build_scripts.py
@@ -13,11 +13,12 @@
import sysconfig
except ImportError:
from distutils2._backport import sysconfig
+from distutils2.compat import Mixin2to3
# check if Python is called on the first line with this expression
first_line_re = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
-class build_scripts (Command):
+class build_scripts (Command, Mixin2to3):
description = "\"build\" scripts (copy and fixup #! line)"
@@ -56,9 +57,10 @@
def run (self):
if not self.scripts:
return
- self.copy_scripts()
-
-
+ copied_files = self.copy_scripts()
+ if self.use_2to3 and self.copied_files:
+ self._run_2to3(self.copied_files, fixers=self.use_2to3_fixers)
+
def copy_scripts (self):
"""Copy each script listed in 'self.scripts'; if it's marked as a
Python script in the Unix way (first line matches 'first_line_re',
@@ -133,7 +135,7 @@
log.info("changing mode of %s from %o to %o",
file, oldmode, newmode)
os.chmod(file, newmode)
-
+ return outfiles
# copy_scripts ()
# class build_scripts
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list