Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 532f0b7

Browse files
committed
Include directories from config var DESTDIRS in npython's runtime library dirs for python built with --enable-shared.
1 parent da2bb40 commit 532f0b7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from distutils.command.build_ext import build_ext
77
from distutils.command.build_scripts import build_scripts
88
from distutils.command.install_lib import install_lib
9-
from distutils.sysconfig import get_config_vars
9+
from distutils.sysconfig import get_config_var
1010
from platform import architecture
1111
from subprocess import Popen, CalledProcessError, PIPE, check_call
1212
from glob import glob
@@ -183,15 +183,22 @@ def _build_monoclr(self, ext):
183183
depends=ext.depends)
184184

185185
output_dir = os.path.dirname(self.get_ext_fullpath(ext.name))
186-
py_libs = get_config_vars("BLDLIBRARY")[0]
186+
py_libs = get_config_var("BLDLIBRARY")
187187
libs += " " + py_libs
188188

189+
# Include the directories python's shared libs were installed to. This
190+
# is case python was built with --enable-shared as then npython will need
191+
# to be able to find libpythonX.X.so.
192+
runtime_library_dirs = (get_config_var("DESTDIRS") or "").split(" ")
193+
if ext.runtime_library_dirs:
194+
runtime_library_dirs.extend(ext.runtime_library_dirs)
195+
189196
self.compiler.link_executable(objects,
190197
_npython_exe,
191198
output_dir=output_dir,
192199
libraries=self.get_libraries(ext),
193200
library_dirs=ext.library_dirs,
194-
runtime_library_dirs=ext.runtime_library_dirs,
201+
runtime_library_dirs=runtime_library_dirs,
195202
extra_postargs=libs.split(" "),
196203
debug=self.debug)
197204

0 commit comments

Comments
 (0)