diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-05 22:55:00 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-05 22:55:00 (GMT) |
commit | f28849af829bc31a27d4688ccd31e60724bb53da (patch) | |
tree | a5bb09fce7a7e1488fe625adac6c5fade321582f /Lib/distutils | |
parent | 227f6c0e32d598f6abaac08fc6da661386171e5a (diff) | |
download | cpython-f28849af829bc31a27d4688ccd31e60724bb53da.zip cpython-f28849af829bc31a27d4688ccd31e60724bb53da.tar.gz cpython-f28849af829bc31a27d4688ccd31e60724bb53da.tar.bz2 |
Merged revisions 69316 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69316 | tarek.ziade | 2009-02-05 23:52:52 +0100 (Thu, 05 Feb 2009) | 1 line
Fixed #5132: enable extensions to link on Solaris
........
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/build_ext.py | 8 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 21 |
2 files changed, 26 insertions, 3 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 1461409..936ea8d 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -233,10 +233,12 @@ class build_ext (Command): # building python standard extensions self.library_dirs.append('.') - # for extensions under Linux with a shared Python library, + # for extensions under Linux or Solaris with a shared Python library, # Python's library directory must be appended to library_dirs - if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \ - and sysconfig.get_config_var('Py_ENABLE_SHARED'): + sysconfig.get_config_var('Py_ENABLE_SHARED') + if ((sys.platform.startswith('linux') or sys.platform.startswith('gnu') + or sys.platform.startswith('sunos')) + and sysconfig.get_config_var('Py_ENABLE_SHARED')): if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): # building third party extensions self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 31b8b48..d0cce9b 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -65,6 +65,27 @@ class BuildExtTestCase(unittest.TestCase): # XXX on Windows the test leaves a directory with xx module in TEMP shutil.rmtree(self.tmp_dir, os.name == 'nt' or sys.platform == 'cygwin') + def test_solaris_enable_shared(self): + dist = Distribution({'name': 'xx'}) + cmd = build_ext(dist) + old = sys.platform + + sys.platform = 'sunos' # fooling finalize_options + from distutils.sysconfig import _config_vars + old_var = _config_vars.get('Py_ENABLE_SHARED') + _config_vars['Py_ENABLE_SHARED'] = 1 + try: + cmd.ensure_finalized() + finally: + sys.platform = old + if old_var is None: + del _config_vars['Py_ENABLE_SHARED'] + else: + _config_vars['Py_ENABLE_SHARED'] = old_var + + # make sur we get some lobrary dirs under solaris + self.assert_(len(cmd.library_dirs) > 0) + def test_suite(): if not sysconfig.python_build: if test_support.verbose: |