提交 4d365f68 authored 作者: Ben Mares's avatar Ben Mares 提交者: Thomas Wiecki

Fix PyPy by eliminating deprecated library detection code

PyPy fails when handled here as a special case. For example, the correct value for libname may be "pypy3.9-c" and can be inferred from LDLIBRARY, but setting it to "pypy3-c" leads to failure with `ld: cannot find -lpypy3-c: No such file or directory`.
上级 4ee35881
......@@ -1751,30 +1751,23 @@ def std_lib_dirs_and_libs() -> Optional[tuple[list[str], ...]]:
elif sys.platform == "darwin":
std_lib_dirs_and_libs.data = [], []
else:
if platform.python_implementation() == "PyPy":
# Assume Linux (note: Ubuntu doesn't ship this .so)
libname = "pypy3-c"
# Unfortunately the only convention of this .so is that it appears
# next to the location of the interpreter binary.
libdir = os.path.dirname(os.path.realpath(sys.executable))
else:
# Assume Linux
# Typical include directory: /usr/include/python2.6
# Assume Linux
# Typical include directory: /usr/include/python2.6
# get the name of the python library (shared object)
# get the name of the python library (shared object)
libname = str(get_config_var("LDLIBRARY"))
libname = str(get_config_var("LDLIBRARY"))
if libname.startswith("lib"):
libname = libname[3:]
if libname.startswith("lib"):
libname = libname[3:]
# remove extension if present
if libname.endswith(".so"):
libname = libname[:-3]
elif libname.endswith(".a"):
libname = libname[:-2]
# remove extension if present
if libname.endswith(".so"):
libname = libname[:-3]
elif libname.endswith(".a"):
libname = libname[:-2]
libdir = str(get_config_var("LIBDIR"))
libdir = str(get_config_var("LIBDIR"))
std_lib_dirs_and_libs.data = [libname], [libdir]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论