]> granicus.if.org Git - python/commitdiff
Merged revisions 69316 via svnmerge from
authorTarek Ziadé <ziade.tarek@gmail.com>
Thu, 5 Feb 2009 22:56:14 +0000 (22:56 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Thu, 5 Feb 2009 22:56:14 +0000 (22:56 +0000)
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
........

Lib/distutils/command/build_ext.py
Lib/distutils/tests/test_build_ext.py
Misc/NEWS

index 7ef5becc6f44723847c15b43a39317852c2eef96..b12da63f8450fb2a562239415771f4c900003aa5 100644 (file)
@@ -229,10 +229,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'))
index 527529777d8ac50a6b21ea5655849cee649a5fe9..4c5723255ad39d4d4fb0e9b6d93d58882675504c 100644 (file)
@@ -75,6 +75,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 support.verbose:
index 68cea16ac502e607ab8d18e2c355345705e20719..20a4f89f8bb26544c0ed69b98bb70468efb3ef98 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -155,6 +155,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #5132: Fixed trouble building extensions under Solaris with 
+  --enabled-shared activated. Initial patch by Dave Peterson.
+
 - Issue #1581476: Always use the Tcl global namespace when calling into Tcl.
 
 - The shelve module now defaults to pickle protocol 3.