@@ -130,6 +130,22 @@ 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+ if user_site is None : # User-site not available.
141+ return False
142+ try :
143+ paths = sysconfig .get_paths (scheme = "posix_user" , expand = False )
144+ except KeyError : # User-site not available.
145+ return False
146+ return "/lib64/" in paths ["purelib" ] and "/lib64/" not in user_site
147+
148+
133149@functools .lru_cache (maxsize = None )
134150def _looks_like_msys2_mingw_scheme () -> bool :
135151 """MSYS2 patches distutils and sysconfig to use a UNIX-like scheme.
@@ -285,6 +301,17 @@ def get_scheme(
285301 if skip_bpo_44860 :
286302 continue
287303
304+ # Slackware incorrectly patches posix_user to use lib64 instead of lib,
305+ # but not usersite to match the location.
306+ skip_slackware_user_scheme = (
307+ user
308+ and k in ("platlib" , "purelib" )
309+ and not WINDOWS
310+ and _looks_like_slackware_scheme ()
311+ )
312+ if skip_slackware_user_scheme :
313+ continue
314+
288315 # Both Debian and Red Hat patch Python to place the system site under
289316 # /usr/local instead of /usr. Debian also places lib in dist-packages
290317 # instead of site-packages, but the /usr/local check should cover it.
0 commit comments