summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-10-21 18:46:36 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-10-21 18:46:36 (GMT)
commit8ad8039636e7974c8a1dead451323e24c0b2c2c5 (patch)
tree44afe2c942cc76edf276ad72020b2972ca1c6b8c /Lib
parent4d3d08f961ff632f5e1e05d432ee7204fdd16800 (diff)
downloadcpython-8ad8039636e7974c8a1dead451323e24c0b2c2c5.zip
cpython-8ad8039636e7974c8a1dead451323e24c0b2c2c5.tar.gz
cpython-8ad8039636e7974c8a1dead451323e24c0b2c2c5.tar.bz2
Backport fix for #10126
Diffstat (limited to 'Lib')
-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 b7cdc20..04ebc5b 100644
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -42,6 +42,20 @@ class BuildExtTestCase(TempdirManager,
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
+ 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)]
+
def test_build_ext(self):
global ALREADY_TESTED
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
@@ -49,6 +63,7 @@ class BuildExtTestCase(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