summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-02-13 23:00:43 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-02-13 23:00:43 (GMT)
commit2432b0b36785031acc53886a893d792ff2636765 (patch)
treeb90f06d26feb05b9a609819fd1bf215d52b34dc5 /Lib
parent275958aacfb2a9fd4b363d33defa4a92649fb533 (diff)
downloadcpython-2432b0b36785031acc53886a893d792ff2636765.zip
cpython-2432b0b36785031acc53886a893d792ff2636765.tar.gz
cpython-2432b0b36785031acc53886a893d792ff2636765.tar.bz2
Fixed #4524: distutils build_script command failed with --with-suffix=3
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/build_scripts.py4
-rw-r--r--Lib/distutils/tests/test_build_scripts.py28
2 files changed, 30 insertions, 2 deletions
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index 48e06aa..2ad4c7b 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -102,8 +102,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()
diff --git a/Lib/distutils/tests/test_build_scripts.py b/Lib/distutils/tests/test_build_scripts.py
index 666ca44..2acfab8 100644
--- a/Lib/distutils/tests/test_build_scripts.py
+++ b/Lib/distutils/tests/test_build_scripts.py
@@ -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)