Skip to content

Commit e11d8ba

Browse files
committed
Let C compiler also try to find shared lib without *.pyston.so
When Pyston try to build C extension, it will add *.pyston suffix. Pyston add this by define `"SO": ".pyston.so"` in _sysconfigdata.in. We need to let Pyston also find shared library without *.pyston.so suffix when build C extension.
1 parent 6ff7395 commit e11d8ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

from_cpython/Lib/distutils/unixccompiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ def find_library_file(self, dirs, lib, debug=0):
246246
shared_f = self.library_filename(lib, lib_type='shared')
247247
dylib_f = self.library_filename(lib, lib_type='dylib')
248248
static_f = self.library_filename(lib, lib_type='static')
249+
non_pyston_shared_f = '.'.join(shared_f.split('.')[:-2] + ['so'])
249250

250251
if sys.platform == 'darwin':
251252
# On OSX users can specify an alternate SDK using
@@ -262,6 +263,7 @@ def find_library_file(self, dirs, lib, debug=0):
262263

263264
for dir in dirs:
264265
shared = os.path.join(dir, shared_f)
266+
non_pyston_shared = os.path.join(dir, non_pyston_shared_f)
265267
dylib = os.path.join(dir, dylib_f)
266268
static = os.path.join(dir, static_f)
267269

@@ -281,6 +283,8 @@ def find_library_file(self, dirs, lib, debug=0):
281283
return dylib
282284
elif os.path.exists(shared):
283285
return shared
286+
elif os.path.exists(non_pyston_shared):
287+
return non_pyston_shared
284288
elif os.path.exists(static):
285289
return static
286290

0 commit comments

Comments
 (0)