gh-121103: Put free-threaded libraries in lib/python3.14t (#121293)

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.
This commit is contained in:
Sam Gross 2024-07-11 16:21:37 -04:00 committed by GitHub
parent 5250a03133
commit e8c91d90ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 77 additions and 40 deletions

View file

@ -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: