mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
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.
This commit is contained in:
parent
7a084105a0
commit
175eb995d3
3 changed files with 30 additions and 23 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue