mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Fix test_packaging on Windows (#12678).
See the distutils commit message for more detail.
This commit is contained in:
parent
09ab4f86e8
commit
e049f470cd
2 changed files with 16 additions and 4 deletions
|
|
@ -323,8 +323,8 @@ def fixup_build_ext(cmd):
|
||||||
support.fixup_build_ext(cmd)
|
support.fixup_build_ext(cmd)
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
"""
|
"""
|
||||||
if os.name == "nt":
|
if os.name == 'nt':
|
||||||
cmd.debug = sys.executable.endswith("_d.exe")
|
cmd.debug = sys.executable.endswith('_d.exe')
|
||||||
elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
|
elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
|
||||||
# To further add to the shared builds fun on Unix, we can't just add
|
# 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
|
# library_dirs to the Extension() instance because that doesn't get
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import sys
|
||||||
from sysconfig import (get_scheme_names, get_config_vars,
|
from sysconfig import (get_scheme_names, get_config_vars,
|
||||||
_SCHEMES, get_config_var, get_path)
|
_SCHEMES, get_config_var, get_path)
|
||||||
|
|
||||||
|
from packaging.command.build_ext import build_ext
|
||||||
from packaging.command.install_dist import install_dist
|
from packaging.command.install_dist import install_dist
|
||||||
from packaging.compiler.extension import Extension
|
from packaging.compiler.extension import Extension
|
||||||
from packaging.dist import Distribution
|
from packaging.dist import Distribution
|
||||||
|
|
@ -16,6 +17,13 @@ from packaging.tests import unittest, support
|
||||||
_CONFIG_VARS = get_config_vars()
|
_CONFIG_VARS = get_config_vars()
|
||||||
|
|
||||||
|
|
||||||
|
def _make_ext_name(modname):
|
||||||
|
if os.name == 'nt':
|
||||||
|
if sys.executable.endswith('_d.exe'):
|
||||||
|
modname += '_d'
|
||||||
|
return modname + get_config_var('SO')
|
||||||
|
|
||||||
|
|
||||||
class InstallTestCase(support.TempdirManager,
|
class InstallTestCase(support.TempdirManager,
|
||||||
support.LoggingCatcher,
|
support.LoggingCatcher,
|
||||||
unittest.TestCase):
|
unittest.TestCase):
|
||||||
|
|
@ -204,10 +212,14 @@ class InstallTestCase(support.TempdirManager,
|
||||||
Extension('xx', ['xxmodule.c'])])
|
Extension('xx', ['xxmodule.c'])])
|
||||||
os.chdir(project_dir)
|
os.chdir(project_dir)
|
||||||
support.copy_xxmodule_c(project_dir)
|
support.copy_xxmodule_c(project_dir)
|
||||||
support.fixup_build_ext(dist.get_command_obj('build_ext'))
|
|
||||||
|
buildextcmd = build_ext(dist)
|
||||||
|
support.fixup_build_ext(buildextcmd)
|
||||||
|
buildextcmd.ensure_finalized()
|
||||||
|
|
||||||
cmd = install_dist(dist)
|
cmd = install_dist(dist)
|
||||||
dist.command_obj['install_dist'] = cmd
|
dist.command_obj['install_dist'] = cmd
|
||||||
|
dist.command_obj['build_ext'] = buildextcmd
|
||||||
cmd.root = install_dir
|
cmd.root = install_dir
|
||||||
cmd.record = os.path.join(project_dir, 'filelist')
|
cmd.record = os.path.join(project_dir, 'filelist')
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
|
|
@ -217,7 +229,7 @@ class InstallTestCase(support.TempdirManager,
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
found = [os.path.basename(line) for line in content.splitlines()]
|
found = [os.path.basename(line) for line in content.splitlines()]
|
||||||
expected = ['xx%s' % get_config_var('SO'),
|
expected = [_make_ext_name('xx'),
|
||||||
'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD']
|
'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD']
|
||||||
self.assertEqual(found, expected)
|
self.assertEqual(found, expected)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue