diff options
author | Éric Araujo <merwok@netwok.org> | 2011-08-23 23:29:10 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-08-23 23:29:10 (GMT) |
commit | 175eb995d342ebdffb7f56d106fd47e7253a043a (patch) | |
tree | 24bd6cab5ef1ead31f82730cd385ec8c7755bcc8 /Lib/distutils/tests/support.py | |
parent | 7a084105a0ebd0b309ef9b036e9d7922d6c0c555 (diff) | |
download | cpython-175eb995d342ebdffb7f56d106fd47e7253a043a.zip cpython-175eb995d342ebdffb7f56d106fd47e7253a043a.tar.gz cpython-175eb995d342ebdffb7f56d106fd47e7253a043a.tar.bz2 |
Fix distutils tests on Windows (#12678).
- First, support.fixup_build_ext (already used to set proper
library_dirs value under Unix shared builds) gains the ability to
correctly set the debug attribute under Windows debug builds.
- Second, the filename for the extension module gets a _d suffix under
debug builds.
- Third, the test code properly puts our customized build_ext object
into an internal dictionary to make sure that the install command will
later use our object instead of re-creating one. That’s the downside
of using low-level APIs in our test code: we have to manually push
knobs and turn handles that would otherwise be handled behind the
scenes.
Thanks to Nadeem for the testing.
Diffstat (limited to 'Lib/distutils/tests/support.py')
-rw-r--r-- | Lib/distutils/tests/support.py | 28 |
1 files changed, 17 insertions, 11 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 = ['.'] |