|
6 | 6 | from distutils.command.build_ext import build_ext
|
7 | 7 | from distutils.command.build_scripts import build_scripts
|
8 | 8 | from distutils.command.install_lib import install_lib
|
9 |
| -from distutils.sysconfig import get_config_vars |
| 9 | +from distutils.sysconfig import get_config_var |
10 | 10 | from platform import architecture
|
11 | 11 | from subprocess import Popen, CalledProcessError, PIPE, check_call
|
12 | 12 | from glob import glob
|
@@ -183,15 +183,22 @@ def _build_monoclr(self, ext):
|
183 | 183 | depends=ext.depends)
|
184 | 184 |
|
185 | 185 | 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") |
187 | 187 | libs += " " + py_libs
|
188 | 188 |
|
| 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 | + |
189 | 196 | self.compiler.link_executable(objects,
|
190 | 197 | _npython_exe,
|
191 | 198 | output_dir=output_dir,
|
192 | 199 | libraries=self.get_libraries(ext),
|
193 | 200 | library_dirs=ext.library_dirs,
|
194 |
| - runtime_library_dirs=ext.runtime_library_dirs, |
| 201 | + runtime_library_dirs=runtime_library_dirs, |
195 | 202 | extra_postargs=libs.split(" "),
|
196 | 203 | debug=self.debug)
|
197 | 204 |
|
|
0 commit comments