]> granicus.if.org Git - python/commitdiff
Merged revisions 69598 via svnmerge from
authorTarek Ziadé <ziade.tarek@gmail.com>
Fri, 13 Feb 2009 23:04:17 +0000 (23:04 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Fri, 13 Feb 2009 23:04:17 +0000 (23:04 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69598 | tarek.ziade | 2009-02-14 00:00:43 +0100 (Sat, 14 Feb 2009) | 1 line

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

Lib/distutils/command/build_scripts.py
Lib/distutils/tests/test_build_scripts.py
Misc/NEWS

index dc04a9fcdbb0ba5d1dff3437786be2410314fabd..8b08bfeaf0209d66c099b0de2f7e2cdfcead31d9 100644 (file)
@@ -104,8 +104,8 @@ class build_scripts(Command):
                         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()
index 666ca44c1d304a53292805f7a1ddc01f5855a19d..2acfab828effc5bd38c641a80a86d7398cbfa609 100644 (file)
@@ -5,6 +5,7 @@ import unittest
 
 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 @@ class BuildScriptsTestCase(support.TempdirManager,
         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)
index bd585c46c9fd49d3cade06267cf28b36df4b1f5b..870b7cdddfffb17bfe840924ae36907509704fc6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -166,6 +166,9 @@ Core and Builtins
 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 #4998: The memory saving effect of __slots__ had been lost on Fractions