Skip to content

Commit 5b8e0e4

Browse files
committed
Add clause to silence warning for Slackware bug
1 parent 95a1605 commit 5b8e0e4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/pip/_internal/locations/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ def _looks_like_red_hat_scheme() -> bool:
130130
)
131131

132132

133+
@functools.lru_cache(maxsize=None)
134+
def _looks_like_slackware_scheme() -> bool:
135+
"""Slackware patches sysconfig but fails to patch distutils and site.
136+
137+
Slackware changes sysconfig's user scheme to use ``"lib64"`` for the lib
138+
path, but does not do the same to the site module.
139+
"""
140+
try:
141+
paths = sysconfig.get_paths(scheme="posix_user", expand=False)
142+
except KeyError: # User-site not available.
143+
return False
144+
return "/lib64/" in paths["purelib"] and "/lib64/" not in user_site
145+
146+
133147
@functools.lru_cache(maxsize=None)
134148
def _looks_like_msys2_mingw_scheme() -> bool:
135149
"""MSYS2 patches distutils and sysconfig to use a UNIX-like scheme.
@@ -285,6 +299,17 @@ def get_scheme(
285299
if skip_bpo_44860:
286300
continue
287301

302+
# Slackware incorrectly patches posix_user to use lib64 instead of lib,
303+
# but not usersite to match the location.
304+
skip_slackware_user_scheme = (
305+
user
306+
and k in ("platlib", "purelib")
307+
and not WINDOWS
308+
and _looks_like_slackware_scheme()
309+
)
310+
if skip_slackware_user_scheme:
311+
continue
312+
288313
# Both Debian and Red Hat patch Python to place the system site under
289314
# /usr/local instead of /usr. Debian also places lib in dist-packages
290315
# instead of site-packages, but the /usr/local check should cover it.

0 commit comments

Comments
 (0)