File tree 3 files changed +26
-4
lines changed
3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,9 @@ def finalize_options (self):
185
185
186
186
# for extensions under Cygwin and AtheOS Python's library directory must be
187
187
# appended to library_dirs
188
- if sys .platform [:6 ] == 'cygwin' or sys .platform [:6 ] == 'atheos' :
188
+ if sys .platform [:6 ] == 'cygwin' or sys .platform [:6 ] == 'atheos' or \
189
+ (sys .platform .startswith ('linux' ) and
190
+ sysconfig .get_config_var ('Py_ENABLE_SHARED' )):
189
191
if string .find (sys .executable , sys .exec_prefix ) != - 1 :
190
192
# building third party extensions
191
193
self .library_dirs .append (os .path .join (sys .prefix , "lib" ,
@@ -688,6 +690,13 @@ def get_libraries (self, ext):
688
690
# extensions, it is a reference to the original list
689
691
return ext .libraries + [pythonlib , "m" ] + extra
690
692
else :
691
- return ext .libraries
693
+ from distutils import sysconfig
694
+ if sysconfig .get_config_var ('Py_ENABLE_SHARED' ):
695
+ template = "python%d.%d"
696
+ pythonlib = (template %
697
+ (sys .hexversion >> 24 , (sys .hexversion >> 16 ) & 0xff ))
698
+ return ext .libraries + [pythonlib ]
699
+ else :
700
+ return ext .libraries
692
701
693
702
# class build_ext
Original file line number Diff line number Diff line change @@ -213,8 +213,8 @@ def parse_config_h(fp, g=None):
213
213
"""
214
214
if g is None :
215
215
g = {}
216
- define_rx = re .compile ("#define ([A-Z][A-Z0 -9_]+) (.*)\n " )
217
- undef_rx = re .compile ("/[*] #undef ([A-Z][A-Z0 -9_]+) [*]/\n " )
216
+ define_rx = re .compile ("#define ([A-Z][A-Za-z0 -9_]+) (.*)\n " )
217
+ undef_rx = re .compile ("/[*] #undef ([A-Z][A-Za-z0 -9_]+) [*]/\n " )
218
218
#
219
219
while 1 :
220
220
line = fp .readline ()
@@ -351,6 +351,17 @@ def _init_posix():
351
351
352
352
raise DistutilsPlatformError (my_msg )
353
353
354
+ # load the installed pyconfig.h:
355
+ try :
356
+ filename = get_config_h_filename ()
357
+ parse_config_h (file (filename ), g )
358
+ except IOError , msg :
359
+ my_msg = "invalid Python installation: unable to open %s" % filename
360
+ if hasattr (msg , "strerror" ):
361
+ my_msg = my_msg + " (%s)" % msg .strerror
362
+
363
+ raise DistutilsPlatformError (my_msg )
364
+
354
365
# On MacOSX we need to check the setting of the environment variable
355
366
# MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
356
367
# it needs to be compatible.
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ Library
33
33
Build
34
34
-----
35
35
36
+ - Patch #1429775: Link extension modules with the shared libpython.
37
+
36
38
C API
37
39
-----
38
40
You can’t perform that action at this time.
0 commit comments