mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Factor out the build_ext fixup for shared Python builds.
I need this to fix the failing test_command_install_dist.
This commit is contained in:
parent
cd7c3d9d5f
commit
2737222b49
2 changed files with 29 additions and 22 deletions
|
@ -32,25 +32,6 @@ class BuildExtTestCase(support.TempdirManager,
|
|||
|
||||
super(BuildExtTestCase, self).tearDown()
|
||||
|
||||
def _fixup_command(self, cmd):
|
||||
# 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.
|
||||
#
|
||||
# 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')):
|
||||
runshared = sysconfig.get_config_var('RUNSHARED')
|
||||
if runshared is None:
|
||||
cmd.library_dirs = ['.']
|
||||
else:
|
||||
name, equals, value = runshared.partition('=')
|
||||
cmd.library_dirs = value.split(os.pathsep)
|
||||
|
||||
def test_build_ext(self):
|
||||
support.copy_xxmodule_c(self.tmp_dir)
|
||||
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
|
||||
|
@ -58,7 +39,7 @@ class BuildExtTestCase(support.TempdirManager,
|
|||
dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
|
||||
dist.package_dir = self.tmp_dir
|
||||
cmd = build_ext(dist)
|
||||
self._fixup_command(cmd)
|
||||
support.fixup_build_ext(cmd)
|
||||
|
||||
if os.name == "nt":
|
||||
# On Windows, we must build a debug version iff running
|
||||
|
@ -251,7 +232,7 @@ class BuildExtTestCase(support.TempdirManager,
|
|||
dist = Distribution({'name': 'xx',
|
||||
'ext_modules': [ext]})
|
||||
cmd = build_ext(dist)
|
||||
self._fixup_command(cmd)
|
||||
support.fixup_build_ext(cmd)
|
||||
cmd.ensure_finalized()
|
||||
self.assertEqual(len(cmd.get_outputs()), 1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue