diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-10 08:53:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 08:53:09 (GMT) |
commit | 8510f430781118d9b603c3a2f06945d6ebc5fe42 (patch) | |
tree | 511cb42b478dd031ff36297a5e0c78b27a4e77a2 /Lib/site.py | |
parent | 700cb587303461d5a96456c56902cfdd8ad50e2d (diff) | |
download | cpython-8510f430781118d9b603c3a2f06945d6ebc5fe42.zip cpython-8510f430781118d9b603c3a2f06945d6ebc5fe42.tar.gz cpython-8510f430781118d9b603c3a2f06945d6ebc5fe42.tar.bz2 |
bpo-1294959: Add sys.platlibdir attribute (GH-18381)
Add --with-platlibdir option to the configure script: name of the
platform-specific library directory, stored in the new sys.platlitdir
attribute. It is used to build the path of platform-specific dynamic
libraries and the path of the standard library.
It is equal to "lib" on most platforms. On Fedora and SuSE, it is
equal to "lib64" on 64-bit systems.
Co-Authored-By: Jan Matějek <jmatejek@suse.com>
Co-Authored-By: Matěj Cepl <mcepl@cepl.eu>
Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/site.py b/Lib/site.py index 2c71798..e981a14 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -334,13 +334,22 @@ def getsitepackages(prefixes=None): continue seen.add(prefix) + libdirs = [sys.platlibdir] + if sys.platlibdir != "lib": + libdirs.append("lib") + if os.sep == '/': - sitepackages.append(os.path.join(prefix, "lib", - "python%d.%d" % sys.version_info[:2], - "site-packages")) + for libdir in libdirs: + path = os.path.join(prefix, libdir, + "python%d.%d" % sys.version_info[:2], + "site-packages") + sitepackages.append(path) else: sitepackages.append(prefix) - sitepackages.append(os.path.join(prefix, "lib", "site-packages")) + + for libdir in libdirs: + path = os.path.join(prefix, libdir, "site-packages") + sitepackages.append(path) return sitepackages def addsitepackages(known_paths, prefixes=None): |