Fix source bootstrapping for Debian and derivatives (#39107)

* Fix Python package.py for Debian and derivatives to find the system Python library location

When bootstrapping from source, find_library() does not contain any paths that work for Debian and derivatives.  fixes #36666

* Update to pass styling

* Update to styling

* Update python package.py with fake config value for LIBPL

* Update python package.py libpl config_vars entry to follow double quote standard

* styling update
This commit is contained in:
vucoda 2023-08-01 17:12:46 +09:30 committed by GitHub
parent b8590fbd05
commit b28ae67369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -878,6 +878,9 @@ def config_vars(self):
"INCLUDEPY": self.prefix.include.join("python{}").format(version),
"LIBDEST": self.prefix.lib.join("python{}").format(version),
"LIBDIR": self.prefix.lib,
"LIBPL": self.prefix.lib.join("python{0}")
.join("config-{0}-{1}")
.format(version, sys.platform),
"LDLIBRARY": "{}python{}.{}".format(lib_prefix, version, dso_suffix),
"LIBRARY": "{}python{}.{}".format(lib_prefix, version, stat_suffix),
"LDSHARED": "cc",
@ -947,6 +950,10 @@ def find_library(self, library):
# in either lib or lib64, so we need to ask Python where its LIBDIR is.
libdir = self.config_vars["LIBDIR"]
# Debian and derivatives use a triplet subdir under /usr/lib, LIBPL can be used
# to get the Python library directory
libpldir = self.config_vars["LIBPL"]
# The system Python installation on macOS and Homebrew installations
# install libraries into a Frameworks directory
frameworkprefix = self.config_vars["PYTHONFRAMEWORKPREFIX"]
@ -962,7 +969,14 @@ def find_library(self, library):
win_bin_dir = self.config_vars["BINDIR"]
win_root_dir = self.config_vars["prefix"]
directories = [libdir, frameworkprefix, macos_developerdir, win_bin_dir, win_root_dir]
directories = [
libdir,
libpldir,
frameworkprefix,
macos_developerdir,
win_bin_dir,
win_root_dir,
]
# The Python shipped with Xcode command line tools isn't in any of these locations
for subdir in ["lib", "lib64"]: