From 577103e2dcc8e89729e6df6399d89c6e45ddb907 Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Mon, 1 Sep 2025 19:45:50 +0300 Subject: [PATCH 135/N] Fix windows cert store import in pythonfiles. Add libb2 to dependencies of Python. Simplify mingw conditions. --- Lib/compileall.py | 2 +- Lib/ctypes/__init__.py | 9 +++++---- Lib/site.py | 2 +- Lib/ssl.py | 4 ++-- Lib/sysconfig/__init__.py | 1 + Modules/getpath.py | 1 + 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Lib/compileall.py b/Lib/compileall.py index c9de7e4..cd450be 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.version.find("MINGW") >= 0: + if 'mingw' in sys.version.lower(): fullname = fullname.replace('\\','/') if not os.path.isdir(fullname): yield fullname diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 108348e..ce6c18b 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -475,10 +475,11 @@ class LibraryLoader(object): cdll = LibraryLoader(CDLL) pydll = LibraryLoader(PyDLL) -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) +if _os.name == "nt": + if 'mingw' in sys.version.lower(): + pythonapi = PyDLL("libpython%d.%d%s.dll" % (_sys.version_info[:2] + (_sys.abiflags,)), None) + else: + 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 c027443..b6a8490 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -434,7 +434,7 @@ def getsitepackages(prefixes=None): abi_thread = 't' else: abi_thread = '' - if os.name == 'posix' or (os.name == "nt" and 'mingw' in sys.version.lower()): + if os.name == 'posix' or '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 cc5f11a..c8703b0 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("MINGW") == -1: +if sys.platform == "win32": 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("MINGW") == -1: + if sys.platform == "win32": 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 dff99c8..6a48054 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -56,6 +56,7 @@ _INSTALL_SCHEMES = { 'include': '{installed_base}/Include', 'platinclude': '{installed_base}/Include', 'scripts': '{base}/Scripts', + 'data': '{base}', }, # Downstream distributors can overwrite the default install scheme. diff --git a/Modules/getpath.py b/Modules/getpath.py index e743161..7883b93 100644 --- a/Modules/getpath.py +++ b/Modules/getpath.py @@ -285,6 +285,7 @@ if EXE_SUFFIX and not hassuffix(program_name, EXE_SUFFIX) and isxfile(program_na if py_setpath: # When Py_SetPath has been called, executable defaults to # the real executable path. + if not executable: executable = real_executable