[Python-checkins] r69598 - in python/trunk: Lib/distutils/command/build_scripts.py Lib/distutils/tests/test_build_scripts.py Misc/NEWS

tarek.ziade python-checkins at python.org
Sat Feb 14 00:00:43 CET 2009


Author: tarek.ziade
Date: Sat Feb 14 00:00:43 2009
New Revision: 69598

Log:
Fixed #4524: distutils build_script command failed with --with-suffix=3

Modified:
   python/trunk/Lib/distutils/command/build_scripts.py
   python/trunk/Lib/distutils/tests/test_build_scripts.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/distutils/command/build_scripts.py
==============================================================================
--- python/trunk/Lib/distutils/command/build_scripts.py	(original)
+++ python/trunk/Lib/distutils/command/build_scripts.py	Sat Feb 14 00:00:43 2009
@@ -102,8 +102,8 @@
                         outf.write("#!%s%s\n" %
                                    (os.path.join(
                             sysconfig.get_config_var("BINDIR"),
-                            "python" + sysconfig.get_config_var("VERSION")
-                                     + sysconfig.get_config_var("EXE")),
+                           "python%s%s" % (sysconfig.get_config_var("VERSION"),
+                                           sysconfig.get_config_var("EXE"))),
                                     post_interp))
                     outf.writelines(f.readlines())
                     outf.close()

Modified: python/trunk/Lib/distutils/tests/test_build_scripts.py
==============================================================================
--- python/trunk/Lib/distutils/tests/test_build_scripts.py	(original)
+++ python/trunk/Lib/distutils/tests/test_build_scripts.py	Sat Feb 14 00:00:43 2009
@@ -5,6 +5,7 @@
 
 from distutils.command.build_scripts import build_scripts
 from distutils.core import Distribution
+from distutils import sysconfig
 
 from distutils.tests import support
 
@@ -73,6 +74,33 @@
         f.write(text)
         f.close()
 
+    def test_version_int(self):
+        source = self.mkdtemp()
+        target = self.mkdtemp()
+        expected = self.write_sample_scripts(source)
+
+
+        cmd = self.get_build_scripts_cmd(target,
+                                         [os.path.join(source, fn)
+                                          for fn in expected])
+        cmd.finalize_options()
+
+        # http://bugs.python.org/issue4524
+        #
+        # On linux-g++-32 with command line `./configure --enable-ipv6
+        # --with-suffix=3`, python is compiled okay but the build scripts
+        # failed when writing the name of the executable
+        old = sysconfig._config_vars.get('VERSION')
+        sysconfig._config_vars['VERSION'] = 4
+        try:
+            cmd.run()
+        finally:
+            if old is not None:
+                sysconfig._config_vars['VERSION'] = old
+
+        built = os.listdir(target)
+        for name in expected:
+            self.assert_(name in built)
 
 def test_suite():
     return unittest.makeSuite(BuildScriptsTestCase)

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sat Feb 14 00:00:43 2009
@@ -155,6 +155,9 @@
 Library
 -------
 
+- Issue #4524: distutils build_script command failed with --with-suffix=3.
+  Initial patch by Amaury Forgeot d'Arc.
+
 - Issue #2461: added tests for distutils.util
 
 - Issue #1008086: Fixed socket.inet_aton() to always return 4 bytes even on


More information about the Python-checkins mailing list