summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-10-21 18:48:59 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-10-21 18:48:59 (GMT)
commite9df5d6866b3da7d3c2e31cc66c1b523943151ff (patch)
tree278e386b9b83a909df71d6c4e578b1d3df5221d9 /Lib/distutils/tests
parent4cc5403527e255bb4942b3ef8bca1b7f65781c29 (diff)
downloadcpython-e9df5d6866b3da7d3c2e31cc66c1b523943151ff.zip
cpython-e9df5d6866b3da7d3c2e31cc66c1b523943151ff.tar.gz
cpython-e9df5d6866b3da7d3c2e31cc66c1b523943151ff.tar.bz2
Backport fix for #10126
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_build_ext.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py
index beb6d96..154771f 100644
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -49,6 +49,20 @@ class BuildExtTestCase(support.TempdirManager,
sys.platform == 'cygwin')
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 not sys.platform.startswith('win'):
+ library_dir = sysconfig.get_config_var('srcdir')
+ cmd.library_dirs = [('.' if library_dir is None else library_dir)]
+
@unittest.skipIf(not os.path.exists(_XX_MODULE_PATH),
'xxmodule.c not found')
def test_build_ext(self):
@@ -58,6 +72,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)
if os.name == "nt":
# On Windows, we must build a debug version iff running
# a debug build of Python