提交 31f59dcf authored 作者: Andre Holzner's avatar Andre Holzner

fixes #3556: more robust determination of python library name and directory in…

fixes #3556: more robust determination of python library name and directory in function std_lib_dirs_and_libs(), now works on private python installations on Linux
上级 dd41f3e9
......@@ -1649,9 +1649,22 @@ def std_lib_dirs_and_libs():
elif sys.platform == 'darwin':
std_lib_dirs_and_libs.data = [], []
else:
# assume Linux
# Typical include directory: /usr/include/python2.6
libname = os.path.basename(python_inc)
std_lib_dirs_and_libs.data = [libname], []
# get the name of the python library (shared object)
libname = distutils.sysconfig.get_config_var("LDLIBRARY")
if libname.startswith("lib"):
libname = libname[3:]
# remove extension if present
if libname.endswith(".so"):
libname = libname[:-3]
libdir = distutils.sysconfig.get_config_var("LIBDIR")
std_lib_dirs_and_libs.data = [ libname ], [ libdir ]
# sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located this returns
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论