Skip to content

Commit

Permalink
Branch merge
Browse files Browse the repository at this point in the history
  • Loading branch information
merwok committed Aug 23, 2011
2 parents ed38bfb + 0fe3605 commit 831fe48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
29 changes: 18 additions & 11 deletions Lib/packaging/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,30 +306,37 @@ def _get_xxmodule_path():


def fixup_build_ext(cmd):
"""Function needed to make build_ext tests pass on shared builds.
"""Function needed to make build_ext tests pass.
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. This function work arounds
that. Example use:
When Python was build with --enable-shared on Unix, -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.
When Python was built with in debug mode on Windows, build_ext commands
need their debug attribute set, and it is not done automatically for
some reason.
This function handles both of these things. Example use:
cmd = build_ext(dist)
support.fixup_build_ext(cmd)
cmd.ensure_finalized()
"""
# 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')):
if os.name == "nt":
cmd.debug = sys.executable.endswith("_d.exe")
elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
# 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
# plumbed through to the final compiler command.
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)


try:
from test.support import skip_unless_symlink
except ImportError:
Expand Down
8 changes: 0 additions & 8 deletions Lib/packaging/tests/test_command_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ def test_build_ext(self):
dist.package_dir = self.tmp_dir
cmd = build_ext(dist)
support.fixup_build_ext(cmd)

if os.name == "nt":
# On Windows, we must build a debug version iff running
# a debug build of Python
cmd.debug = sys.executable.endswith("_d.exe")
cmd.build_lib = self.tmp_dir
cmd.build_temp = self.tmp_dir

Expand Down Expand Up @@ -236,9 +231,6 @@ def test_get_outputs(self):
cmd.ensure_finalized()
self.assertEqual(len(cmd.get_outputs()), 1)

if os.name == "nt":
cmd.debug = sys.executable.endswith("_d.exe")

cmd.build_lib = os.path.join(self.tmp_dir, 'build')
cmd.build_temp = os.path.join(self.tmp_dir, 'tempt')

Expand Down

0 comments on commit 831fe48

Please sign in to comment.