diff options
author | Éric Araujo <merwok@netwok.org> | 2011-08-23 23:58:59 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-08-23 23:58:59 (GMT) |
commit | 09ab4f86e8f7239da4e833589855105ef4f05713 (patch) | |
tree | 65aee733e6230809b9bea5d3e98bdd366b988cc4 | |
parent | 831fe4872646205e662deec534ef566cf557185c (diff) | |
parent | 175eb995d342ebdffb7f56d106fd47e7253a043a (diff) | |
download | cpython-09ab4f86e8f7239da4e833589855105ef4f05713.zip cpython-09ab4f86e8f7239da4e833589855105ef4f05713.tar.gz cpython-09ab4f86e8f7239da4e833589855105ef4f05713.tar.bz2 |
Merge distutils bug fix from 3.2
-rw-r--r-- | Lib/distutils/tests/support.py | 28 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 7 | ||||
-rw-r--r-- | Lib/distutils/tests/test_install.py | 18 |
3 files changed, 30 insertions, 23 deletions
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py index ffef98b..dc0e660 100644 --- a/Lib/distutils/tests/support.py +++ b/Lib/distutils/tests/support.py @@ -169,23 +169,29 @@ def _get_xxmodule_path(): def fixup_build_ext(cmd): - """Function needed to make build_ext tests pass on shared builds. + """Function needed to make build_ext tests pass. - When Python was build with --enable-shared, -L. is not good enough to find - the libpython<blah>.so. This is because regrtest runs it under a tempdir, - not in the top level where the .so lives. By the time we've gotten here, - Python's already been chdir'd to the tempdir. This function work arounds - that. Example use: + When Python was build with --enable-shared on Unix, -L. is not good + enough to find the libpython<blah>.so. This is because regrtest runs + it under a tempdir, not in the top level where the .so lives. By the + time we've gotten here, Python's already been chdir'd to the tempdir. + + When Python was built with in debug mode on Windows, build_ext commands + need their debug attribute set, and it is not done automatically for + some reason. + + This function handles both of these things. Example use: cmd = build_ext(dist) support.fixup_build_ext(cmd) cmd.ensure_finalized() """ - # To further add to the fun, we can't just add library_dirs to the - # Extension() instance because that doesn't get plumbed through to the - # final compiler command. - if (sysconfig.get_config_var('Py_ENABLE_SHARED') and - not sys.platform.startswith('win')): + if os.name == 'nt': + cmd.debug = sys.executable.endswith('_d.exe') + elif sysconfig.get_config_var('Py_ENABLE_SHARED'): + # To further add to the shared builds fun on Unix, we can't just add + # library_dirs to the Extension() instance because that doesn't get + # plumbed through to the final compiler command. runshared = sysconfig.get_config_var('RUNSHARED') if runshared is None: cmd.library_dirs = ['.'] diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 8eb59b4..1827437 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -47,10 +47,6 @@ class BuildExtTestCase(TempdirManager, dist.package_dir = self.tmp_dir cmd = build_ext(dist) fixup_build_ext(cmd) - if os.name == "nt": - # On Windows, we must build a debug version iff running - # a debug build of Python - cmd.debug = sys.executable.endswith("_d.exe") cmd.build_lib = self.tmp_dir cmd.build_temp = self.tmp_dir @@ -305,9 +301,6 @@ class BuildExtTestCase(TempdirManager, cmd.ensure_finalized() self.assertEqual(len(cmd.get_outputs()), 1) - if os.name == "nt": - cmd.debug = sys.executable.endswith("_d.exe") - cmd.build_lib = os.path.join(self.tmp_dir, 'build') cmd.build_temp = os.path.join(self.tmp_dir, 'tempt') diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py index e065aa3..5c105af 100644 --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -18,6 +18,14 @@ from distutils.extension import Extension from distutils.tests import support + +def _make_ext_name(modname): + if os.name == 'nt': + if sys.executable.endswith('_d.exe'): + modname += '_d' + return modname + sysconfig.get_config_var('SO') + + class InstallTestCase(support.TempdirManager, support.EnvironGuard, support.LoggingSilencer, @@ -201,13 +209,13 @@ class InstallTestCase(support.TempdirManager, os.chdir(project_dir) support.copy_xxmodule_c(project_dir) - buildcmd = build_ext(dist) - support.fixup_build_ext(buildcmd) - buildcmd.ensure_finalized() - buildcmd.run() + buildextcmd = build_ext(dist) + support.fixup_build_ext(buildextcmd) + buildextcmd.ensure_finalized() cmd = install(dist) dist.command_obj['install'] = cmd + dist.command_obj['build_ext'] = buildextcmd cmd.root = install_dir cmd.record = os.path.join(project_dir, 'RECORD') cmd.ensure_finalized() @@ -220,7 +228,7 @@ class InstallTestCase(support.TempdirManager, f.close() found = [os.path.basename(line) for line in content.splitlines()] - expected = ['xx%s' % sysconfig.get_config_var('SO'), + expected = [_make_ext_name('xx'), 'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]] self.assertEqual(found, expected) |