* add libb2 as dep * remove "-Wl,--large-address-aware", default now via makepkg * remove 2to3 logic, no longer in Python
318 lines
13 KiB
Diff
318 lines
13 KiB
Diff
From d4019f0724c38a0b3bf7c29a09138e4e9e78e268 Mon Sep 17 00:00:00 2001
|
|
From: Alexey Pavlov <alexpux@gmail.com>
|
|
Date: Thu, 28 Aug 2025 12:12:42 +0300
|
|
Subject: [PATCH 118/N] Remove _POSIX_BUILD variable
|
|
|
|
---
|
|
Lib/compileall.py | 2 +-
|
|
Lib/ctypes/__init__.py | 4 +--
|
|
Lib/site.py | 27 ++++++++++----------
|
|
Lib/ssl.py | 4 +--
|
|
Lib/sysconfig/__init__.py | 34 +++++++++++--------------
|
|
Lib/test/test_importlib/test_windows.py | 2 +-
|
|
Lib/test/test_sysconfig.py | 6 ++---
|
|
Lib/venv/__init__.py | 6 ++---
|
|
8 files changed, 40 insertions(+), 45 deletions(-)
|
|
|
|
diff --git a/Lib/compileall.py b/Lib/compileall.py
|
|
index 8e02d02..c9de7e4 100644
|
|
--- a/Lib/compileall.py
|
|
+++ b/Lib/compileall.py
|
|
@@ -38,7 +38,7 @@ def _walk_dir(dir, maxlevels, quiet=0):
|
|
if name == '__pycache__':
|
|
continue
|
|
fullname = os.path.join(dir, name)
|
|
- if sys.platform == "win32" and sys.version.find("GCC") >= 0:
|
|
+ if sys.version.find("MINGW") >= 0:
|
|
fullname = fullname.replace('\\','/')
|
|
if not os.path.isdir(fullname):
|
|
yield fullname
|
|
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
|
|
index a17c9e1..108348e 100644
|
|
--- a/Lib/ctypes/__init__.py
|
|
+++ b/Lib/ctypes/__init__.py
|
|
@@ -475,10 +475,10 @@ class LibraryLoader(object):
|
|
cdll = LibraryLoader(CDLL)
|
|
pydll = LibraryLoader(PyDLL)
|
|
|
|
-if _os.name == "nt" and _sys.version.find('GCC') >= 0:
|
|
+if _os.name == "nt" and _sys.version.find('MINGW') >= 0:
|
|
pythonapi = PyDLL("libpython%d.%d%s.dll" % (_sys.version_info[:2] + (_sys.abiflags,)), None)
|
|
elif _os.name == "nt":
|
|
- pythonapi = PyDLL("python dll", None, _sys.dllhandle)
|
|
+ pythonapi = PyDLL("python.dll", None, _sys.dllhandle)
|
|
elif _sys.platform == "android":
|
|
pythonapi = PyDLL("libpython%d.%d.so" % _sys.version_info[:2])
|
|
elif _sys.platform == "cygwin":
|
|
diff --git a/Lib/site.py b/Lib/site.py
|
|
index a9e96b7..c027443 100644
|
|
--- a/Lib/site.py
|
|
+++ b/Lib/site.py
|
|
@@ -90,12 +90,6 @@ USER_SITE = None
|
|
USER_BASE = None
|
|
|
|
|
|
-# Same as defined in Lib/sysconfig.py
|
|
-# redeclared since sysconfig is large for site.
|
|
-# GCC[mingw*] use posix build system
|
|
-_POSIX_BUILD = os.name == 'posix' or \
|
|
- (os.name == "nt" and 'GCC' in sys.version)
|
|
-
|
|
def _trace(message):
|
|
if sys.flags.verbose:
|
|
print(message, file=sys.stderr)
|
|
@@ -305,7 +299,7 @@ def _getuserbase():
|
|
def joinuser(*args):
|
|
return os.path.expanduser(os.path.join(*args))
|
|
|
|
- if os.name == "nt" and not _POSIX_BUILD:
|
|
+ if os.name == "nt" and not 'mingw' in sys.version.lower():
|
|
base = os.environ.get("APPDATA") or "~"
|
|
return joinuser(base, _get_implementation())
|
|
|
|
@@ -318,7 +312,7 @@ def _getuserbase():
|
|
# Copy of sysconfig.get_platform() but only for MinGW
|
|
def _get_platform():
|
|
if os.name == 'nt':
|
|
- if 'gcc' in sys.version.lower():
|
|
+ if 'mingw' in sys.version.lower():
|
|
platform = 'mingw'
|
|
if 'amd64' in sys.version.lower():
|
|
platform += '_x86_64'
|
|
@@ -340,6 +334,12 @@ def _get_platform():
|
|
platform += "_gnu"
|
|
|
|
return platform
|
|
+ if 'amd64' in sys.version.lower():
|
|
+ return 'win-amd64'
|
|
+ if '(arm)' in sys.version.lower():
|
|
+ return 'win-arm32'
|
|
+ if '(arm64)' in sys.version.lower():
|
|
+ return 'win-arm64'
|
|
return sys.platform
|
|
|
|
# Same to sysconfig.get_path('purelib', os.name+'_user')
|
|
@@ -353,10 +353,11 @@ def _get_path(userbase):
|
|
implementation = _get_implementation()
|
|
implementation_lower = implementation.lower()
|
|
if os.name == 'nt':
|
|
- if not _POSIX_BUILD:
|
|
- ver_nodot = sys.winver.replace('.', '')
|
|
- return f'{userbase}\\{implementation}{ver_nodot}\\site-packages'
|
|
- return f'{userbase}/lib/python{version[0]}.{version[1]}-{_get_platform()}/site-packages'
|
|
+ if 'mingw' in sys.version.lower():
|
|
+ return f'{userbase}/lib/{implementation_lower}{version[0]}.{version[1]}-{_get_platform()}/site-packages'
|
|
+
|
|
+ ver_nodot = sys.winver.replace('.', '')
|
|
+ return f'{userbase}\\{implementation}{ver_nodot}\\site-packages'
|
|
|
|
if sys.platform == 'darwin' and sys._framework:
|
|
return f'{userbase}/lib/{implementation_lower}/site-packages'
|
|
@@ -433,7 +434,7 @@ def getsitepackages(prefixes=None):
|
|
abi_thread = 't'
|
|
else:
|
|
abi_thread = ''
|
|
- if _POSIX_BUILD:
|
|
+ if os.name == 'posix' or (os.name == "nt" and 'mingw' in sys.version.lower()):
|
|
libdirs = [sys.platlibdir]
|
|
if sys.platlibdir != "lib":
|
|
libdirs.append("lib")
|
|
diff --git a/Lib/ssl.py b/Lib/ssl.py
|
|
index 67119b2..cc5f11a 100644
|
|
--- a/Lib/ssl.py
|
|
+++ b/Lib/ssl.py
|
|
@@ -254,7 +254,7 @@ class _TLSMessageType:
|
|
CHANGE_CIPHER_SPEC = 0x0101
|
|
|
|
|
|
-if sys.platform == "win32" and sys.version.find("GCC") == -1:
|
|
+if sys.platform == "win32" and sys.version.find("MINGW") == -1:
|
|
from _ssl import enum_certificates, enum_crls
|
|
|
|
from socket import socket, SOCK_STREAM, create_connection
|
|
@@ -528,7 +528,7 @@ class SSLContext(_SSLContext):
|
|
def load_default_certs(self, purpose=Purpose.SERVER_AUTH):
|
|
if not isinstance(purpose, _ASN1Object):
|
|
raise TypeError(purpose)
|
|
- if sys.platform == "win32" and sys.version.find("GCC") == -1:
|
|
+ if sys.platform == "win32" and sys.version.find("MINGW") == -1:
|
|
for storename in self._windows_cert_stores:
|
|
self._load_windows_store_certs(storename, purpose)
|
|
self.set_default_verify_paths()
|
|
diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py
|
|
index 84f130b..24900b1 100644
|
|
--- a/Lib/sysconfig/__init__.py
|
|
+++ b/Lib/sysconfig/__init__.py
|
|
@@ -49,12 +49,12 @@ _INSTALL_SCHEMES = {
|
|
'data': '{base}',
|
|
},
|
|
'nt': {
|
|
- 'stdlib': '{installed_base}/lib/python{py_version_short}',
|
|
- 'platstdlib': '{base}/lib/python{py_version_short}',
|
|
- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
|
|
- 'platlib': '{base}/lib/python{py_version_short}/site-packages',
|
|
- 'include': '{installed_base}/include/python{py_version_short}',
|
|
- 'platinclude': '{installed_base}/include/python{py_version_short}',
|
|
+ 'stdlib': '{installed_base}/lib/{implementation_lower}{py_version_short}',
|
|
+ 'platstdlib': '{base}/lib/{implementation_lower}{py_version_short}',
|
|
+ 'purelib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages',
|
|
+ 'platlib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages',
|
|
+ 'include': '{installed_base}/include/{implementation_lower}{py_version_short}',
|
|
+ 'platinclude': '{installed_base}/include/{implementation_lower}{py_version_short}',
|
|
'scripts': '{base}/bin',
|
|
'data': '{base}',
|
|
},
|
|
@@ -100,12 +100,8 @@ _INSTALL_SCHEMES = {
|
|
},
|
|
}
|
|
|
|
-# GCC[mingw*] use posix build system
|
|
-_POSIX_BUILD = os.name == 'posix' or \
|
|
- (os.name == "nt" and 'GCC' in sys.version)
|
|
-
|
|
# For the OS-native venv scheme, we essentially provide an alias:
|
|
-if os.name == 'nt' and not _POSIX_BUILD:
|
|
+if os.name == 'nt' and not 'mingw' in sys.version.lower():
|
|
_INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['nt_venv']
|
|
else:
|
|
_INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['posix_venv']
|
|
@@ -127,7 +123,7 @@ def _getuserbase():
|
|
def joinuser(*args):
|
|
return os.path.expanduser(os.path.join(*args))
|
|
|
|
- if os.name == "nt" and not _POSIX_BUILD:
|
|
+ if os.name == "nt" and not 'mingw' in sys.version.lower():
|
|
base = os.environ.get("APPDATA") or "~"
|
|
return joinuser(base, _get_implementation())
|
|
|
|
@@ -289,7 +285,7 @@ def _expand_vars(scheme, vars):
|
|
|
|
|
|
def _get_preferred_schemes():
|
|
- if os.name == 'nt' and not _POSIX_BUILD:
|
|
+ if os.name == 'nt' and not 'mingw' in sys.version.lower():
|
|
return {
|
|
'prefix': 'nt',
|
|
'home': 'posix_home',
|
|
@@ -430,7 +426,7 @@ def parse_config_h(fp, vars=None):
|
|
def get_config_h_filename():
|
|
"""Return the path of pyconfig.h."""
|
|
if _PYTHON_BUILD:
|
|
- if os.name == "nt" and not _POSIX_BUILD:
|
|
+ if os.name == "nt" and not 'mingw' in sys.version.lower():
|
|
inc_dir = os.path.dirname(sys._base_executable)
|
|
else:
|
|
inc_dir = _PROJECT_BASE
|
|
@@ -499,15 +495,15 @@ def _init_config_vars():
|
|
_CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '')
|
|
except AttributeError:
|
|
_CONFIG_VARS['py_version_nodot_plat'] = ''
|
|
- if os.name == 'nt' and _POSIX_BUILD:
|
|
+ if os.name == 'nt' and 'mingw' in sys.version.lower():
|
|
_CONFIG_VARS['py_version_short_plat'] = f'{_PY_VERSION_SHORT}-{get_platform()}'
|
|
else:
|
|
_CONFIG_VARS['py_version_short_plat'] = _PY_VERSION_SHORT
|
|
|
|
- if os.name == 'nt' and not _POSIX_BUILD:
|
|
+ if os.name == 'nt' and not 'mingw' in sys.version.lower():
|
|
_init_non_posix(_CONFIG_VARS)
|
|
_CONFIG_VARS['VPATH'] = sys._vpath
|
|
- if _POSIX_BUILD:
|
|
+ if os.name == 'posix' or 'mingw' in sys.version.lower():
|
|
_init_posix(_CONFIG_VARS)
|
|
if _HAS_USER_BASE:
|
|
# Setting 'userbase' is done below the call to the
|
|
@@ -520,7 +516,7 @@ def _init_config_vars():
|
|
|
|
# Always convert srcdir to an absolute path
|
|
srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
|
|
- if _POSIX_BUILD:
|
|
+ if os.name == 'posix' or 'mingw' in sys.version.lower():
|
|
if _PYTHON_BUILD:
|
|
# If srcdir is a relative path (typically '.' or '..')
|
|
# then it should be interpreted relative to the directory
|
|
@@ -617,7 +613,7 @@ def get_platform():
|
|
|
|
"""
|
|
if os.name == 'nt':
|
|
- if 'gcc' in sys.version.lower():
|
|
+ if 'mingw' in sys.version.lower():
|
|
platform = 'mingw'
|
|
if 'amd64' in sys.version.lower():
|
|
platform += '_x86_64'
|
|
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
|
|
index 03be17b..8d9373a 100644
|
|
--- a/Lib/test/test_importlib/test_windows.py
|
|
+++ b/Lib/test/test_importlib/test_windows.py
|
|
@@ -25,7 +25,7 @@ def get_platform():
|
|
'arm' : 'win-arm32',
|
|
}
|
|
if os.name == 'nt':
|
|
- if "gcc" in sys.version.lower():
|
|
+ if "mingw" in sys.version.lower():
|
|
platform = "mingw"
|
|
if "amd64" in sys.version.lower():
|
|
platform += "_x86_64"
|
|
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
|
|
index f0dedfe..1f68c6c 100644
|
|
--- a/Lib/test/test_sysconfig.py
|
|
+++ b/Lib/test/test_sysconfig.py
|
|
@@ -25,7 +25,7 @@ import sysconfig
|
|
from sysconfig import (get_paths, get_platform, get_config_vars,
|
|
get_path, get_path_names, _INSTALL_SCHEMES,
|
|
get_default_scheme, get_scheme_names, get_config_var,
|
|
- _expand_vars, _get_preferred_schemes, _POSIX_BUILD)
|
|
+ _expand_vars, _get_preferred_schemes)
|
|
from sysconfig.__main__ import _main, _parse_makefile
|
|
import _imp
|
|
import _osx_support
|
|
@@ -208,7 +208,7 @@ class TestSysConfig(unittest.TestCase):
|
|
self.assertEqual(libpath, sysconfig.get_path('purelib', scheme='nt_venv', vars=vars))
|
|
|
|
def test_venv_scheme(self):
|
|
- if not _POSIX_BUILD and sys.platform == 'win32':
|
|
+ if sys.platform == 'win32' and not 'mingw' in sys.version.lower():
|
|
self.assertEqual(
|
|
sysconfig.get_path('scripts', scheme='venv'),
|
|
sysconfig.get_path('scripts', scheme='nt_venv')
|
|
@@ -421,7 +421,7 @@ class TestSysConfig(unittest.TestCase):
|
|
if HAS_USER_BASE:
|
|
user_path = get_path(name, 'posix_user')
|
|
expected = os.path.normpath(global_path.replace(base, user, 1))
|
|
- if os.name == 'nt' and _POSIX_BUILD:
|
|
+ if os.name == 'nt' and 'mingw' in sys.version.lower():
|
|
expected = expected.replace(
|
|
f'python{sysconfig.get_python_version()}',
|
|
f'python{sysconfig.get_python_version()}-{get_platform()}')
|
|
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
|
|
index c4e441b..b2ec522 100644
|
|
--- a/Lib/venv/__init__.py
|
|
+++ b/Lib/venv/__init__.py
|
|
@@ -13,8 +13,6 @@ import sysconfig
|
|
import types
|
|
import shlex
|
|
|
|
-from sysconfig import _POSIX_BUILD
|
|
-
|
|
CORE_VENV_DEPS = ('pip',)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
@@ -378,7 +376,7 @@ class EnvBuilder:
|
|
}
|
|
|
|
do_copies = True
|
|
- if self.symlinks and not _POSIX_BUILD:
|
|
+ if self.symlinks and not 'mingw' in sys.version.lower():
|
|
do_copies = False
|
|
# For symlinking, we need all the DLLs to be available alongside
|
|
# the executables.
|
|
@@ -414,7 +412,7 @@ class EnvBuilder:
|
|
except OSError:
|
|
logger.warning('Unable to copy %r to %r', src, dest)
|
|
|
|
- if _POSIX_BUILD:
|
|
+ if os.name == 'posix' or (os.name == "nt" and 'mingw' in sys.version.lower()):
|
|
# copy from python/pythonw so the venvlauncher magic in symlink_or_copy triggers
|
|
copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python3.exe'))
|
|
copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python%d.%d.exe' % sys.version_info[:2]))
|