FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed #5132: enable extensions to link on Solaris · java66liu/python@5985ddc · GitHub

forked from glix/python

Commit 5985ddc

Browse files
tarek.ziade
committed
Fixed #5132: enable extensions to link on Solaris
git-svn-id: http://svn.python.org/projects/python/trunk@69316 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent b445262 commit 5985ddc

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

‎Lib/distutils/command/build_ext.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,12 @@ def finalize_options (self):
231231
# building python standard extensions
232232
self.library_dirs.append('.')
233233

234-
# for extensions under Linux with a shared Python library,
234+
# for extensions under Linux or Solaris with a shared Python library,
235235
# Python's library directory must be appended to library_dirs
236-
if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \
237-
and sysconfig.get_config_var('Py_ENABLE_SHARED'):
236+
sysconfig.get_config_var('Py_ENABLE_SHARED')
237+
if ((sys.platform.startswith('linux') or sys.platform.startswith('gnu')
238+
or sys.platform.startswith('sunos'))
239+
and sysconfig.get_config_var('Py_ENABLE_SHARED')):
238240
if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
239241
# building third party extensions
240242
self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))

‎Lib/distutils/tests/test_build_ext.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,27 @@ def tearDown(self):
6767
# XXX on Windows the test leaves a directory with xx module in TEMP
6868
shutil.rmtree(self.tmp_dir, os.name == 'nt' or sys.platform == 'cygwin')
6969

70+
def test_solaris_enable_shared(self):
71+
dist = Distribution({'name': 'xx'})
72+
cmd = build_ext(dist)
73+
old = sys.platform
74+
75+
sys.platform = 'sunos' # fooling finalize_options
76+
from distutils.sysconfig import _config_vars
77+
old_var = _config_vars.get('Py_ENABLE_SHARED')
78+
_config_vars['Py_ENABLE_SHARED'] = 1
79+
try:
80+
cmd.ensure_finalized()
81+
finally:
82+
sys.platform = old
83+
if old_var is None:
84+
del _config_vars['Py_ENABLE_SHARED']
85+
else:
86+
_config_vars['Py_ENABLE_SHARED'] = old_var
87+
88+
# make sur we get some lobrary dirs under solaris
89+
self.assert_(len(cmd.library_dirs) > 0)
90+
7091
def test_suite():
7192
src = _get_source_filename()
7293
if not os.path.exists(src):

‎Misc/NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ Core and Builtins
149149
Library
150150
-------
151151

152+
- Issue #5132: Fixed trouble building extensions under Solaris with
153+
--enabled-shared activated. Initial patch by Dave Peterson.
154+
152155
- Issue #1581476: Always use the Tcl global namespace when calling into Tcl.
153156

154157
- Issue #2047: shutil.move() could believe that its destination path was

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL