summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-07-11 21:00:28 (GMT)
committerGitHub <noreply@github.com>2024-07-11 21:00:28 (GMT)
commit35f7155bc39b8e5212b90a2ee96cb107b51e0e83 (patch)
treef29a5ec83ce96d65bc770ade3fad467ca3f6bbeb /Lib/site.py
parentc6dbfbbe3c24cf2dd6a589904383f28cd1a1f4db (diff)
downloadcpython-35f7155bc39b8e5212b90a2ee96cb107b51e0e83.zip
cpython-35f7155bc39b8e5212b90a2ee96cb107b51e0e83.tar.gz
cpython-35f7155bc39b8e5212b90a2ee96cb107b51e0e83.tar.bz2
[3.13] gh-121103: Put free-threaded libraries in `lib/python3.14t` (GH-121293) (#121631)
On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a "t" suffix to avoid conflicts with a co-located default build installation. (cherry picked from commit e8c91d90ba8fab410a27fad4f709cc73f6ffcbf4) Co-authored-by: Sam Gross <colesbury@gmail.com>
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 95c7ebf..650fa2b 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -312,6 +312,10 @@ def _getuserbase():
# Same to sysconfig.get_path('purelib', os.name+'_user')
def _get_path(userbase):
version = sys.version_info
+ if hasattr(sys, 'abiflags') and 't' in sys.abiflags:
+ abi_thread = 't'
+ else:
+ abi_thread = ''
implementation = _get_implementation()
implementation_lower = implementation.lower()
@@ -322,7 +326,7 @@ def _get_path(userbase):
if sys.platform == 'darwin' and sys._framework:
return f'{userbase}/lib/{implementation_lower}/site-packages'
- return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'
+ return f'{userbase}/lib/python{version[0]}.{version[1]}{abi_thread}/site-packages'
def getuserbase():
@@ -390,6 +394,10 @@ def getsitepackages(prefixes=None):
implementation = _get_implementation().lower()
ver = sys.version_info
+ if hasattr(sys, 'abiflags') and 't' in sys.abiflags:
+ abi_thread = 't'
+ else:
+ abi_thread = ''
if os.sep == '/':
libdirs = [sys.platlibdir]
if sys.platlibdir != "lib":
@@ -397,7 +405,7 @@ def getsitepackages(prefixes=None):
for libdir in libdirs:
path = os.path.join(prefix, libdir,
- f"{implementation}{ver[0]}.{ver[1]}",
+ f"{implementation}{ver[0]}.{ver[1]}{abi_thread}",
"site-packages")
sitepackages.append(path)
else: