summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-12-03 00:08:42 (GMT)
committerGitHub <noreply@github.com>2021-12-03 00:08:42 (GMT)
commit99fcf1505218464c489d419d4500f126b6d6dc28 (patch)
treea9d607d854e943b3651248eadbe2f31f8c410021 /Lib/site.py
parent9f2f7e42269db74a89fc8cd74d82a875787f01d7 (diff)
downloadcpython-99fcf1505218464c489d419d4500f126b6d6dc28.zip
cpython-99fcf1505218464c489d419d4500f126b6d6dc28.tar.gz
cpython-99fcf1505218464c489d419d4500f126b6d6dc28.tar.bz2
bpo-45582: Port getpath[p].c to Python (GH-29041)
The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code. This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/site.py b/Lib/site.py
index e129f3b..b11cd48 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -361,11 +361,11 @@ def getsitepackages(prefixes=None):
continue
seen.add(prefix)
- libdirs = [sys.platlibdir]
- if sys.platlibdir != "lib":
- libdirs.append("lib")
-
if os.sep == '/':
+ libdirs = [sys.platlibdir]
+ if sys.platlibdir != "lib":
+ libdirs.append("lib")
+
for libdir in libdirs:
path = os.path.join(prefix, libdir,
"python%d.%d" % sys.version_info[:2],
@@ -373,10 +373,7 @@ def getsitepackages(prefixes=None):
sitepackages.append(path)
else:
sitepackages.append(prefix)
-
- for libdir in libdirs:
- path = os.path.join(prefix, libdir, "site-packages")
- sitepackages.append(path)
+ sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
return sitepackages
def addsitepackages(known_paths, prefixes=None):