From 7554f65a7121b99818adba847775f6a42cf31320 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Wed, 27 Sep 2023 14:10:42 +0800 Subject: [PATCH 1/2] Corrected the install schemes for minor versions with 2 or more digits. --- patch/Python/Python.patch | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/patch/Python/Python.patch b/patch/Python/Python.patch index 71ebde1..22e1932 100644 --- a/patch/Python/Python.patch +++ b/patch/Python/Python.patch @@ -419,7 +419,7 @@ index 6df5dd551e..597da09643 100644 # waiting for child processes has otherwise been # disabled for our process. This child is dead, we diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index ebe3711827..495dc7bf73 100644 +index ebe3711827..5f2456b5db 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -95,6 +95,33 @@ @@ -427,28 +427,28 @@ index ebe3711827..495dc7bf73 100644 'data': '{base}', }, + 'ios': { -+ 'stdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'platstdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'purelib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], -+ 'platlib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], ++ 'stdlib': '{installed_base}/lib/python{py_version_short}', ++ 'platstdlib': '{installed_base}/lib/python{py_version_short}', ++ 'purelib': '{installed_base}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{installed_base}/lib/python{py_version_short}/site-packages', + 'include': '{installed_base}/include', + 'scripts': '{installed_base}/bin', + 'data': '{installed_base}/Resources', + }, + 'tvos': { -+ 'stdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'platstdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'purelib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], -+ 'platlib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], ++ 'stdlib': '{installed_base}/lib/python{py_version_short}', ++ 'platstdlib': '{installed_base}/lib/python{py_version_short}', ++ 'purelib': '{installed_base}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{installed_base}/lib/python{py_version_short}/site-packages', + 'include': '{installed_base}/include', + 'scripts': '{installed_base}/bin', + 'data': '{installed_base}/Resources', + }, + 'watchos': { -+ 'stdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'platstdlib': '{installed_base}/lib/python%s' % sys.version[:3], -+ 'purelib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], -+ 'platlib': '{installed_base}/lib/python%s/site-packages' % sys.version[:3], ++ 'stdlib': '{installed_base}/lib/python{py_version_short}', ++ 'platstdlib': '{installed_base}/lib/python{py_version_short}', ++ 'purelib': '{installed_base}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{installed_base}/lib/python{py_version_short}/site-packages', + 'include': '{installed_base}/include', + 'scripts': '{installed_base}/bin', + 'data': '{installed_base}/Resources', From 77a7f46df818e55190e0188e710a4926b97bf0f0 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 28 Sep 2023 08:23:20 +0800 Subject: [PATCH 2/2] Add verbose debug for framework loading. --- patch/Python/Python.patch | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/patch/Python/Python.patch b/patch/Python/Python.patch index 22e1932..a22d08a 100644 --- a/patch/Python/Python.patch +++ b/patch/Python/Python.patch @@ -131,7 +131,7 @@ index 2ce5c5b64d..6e10a0c4a5 100644 import pwd os.environ['HOME'] = pwd.getpwuid(os.getuid())[5] diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py -index f603a89f7f..d6db040d0d 100644 +index f603a89f7f..48463efcfc 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -52,7 +52,7 @@ @@ -143,7 +143,7 @@ index f603a89f7f..d6db040d0d 100644 _CASE_INSENSITIVE_PLATFORMS = (_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY + _CASE_INSENSITIVE_PLATFORMS_STR_KEY) -@@ -1705,6 +1705,59 @@ +@@ -1705,6 +1705,60 @@ return 'FileFinder({!r})'.format(self.path) @@ -194,6 +194,7 @@ index f603a89f7f..d6db040d0d 100644 + + for extension in EXTENSION_SUFFIXES: + dylib_file = _path_join(self.frameworks_path, f"{framework_name}.framework", f"{name}{extension}") ++ _bootstrap._verbose_message('Looking for Apple Framework dylib {}', dylib_file) + if _path_isfile(dylib_file): + loader = AppleFrameworkLoader(fullname, dylib_file, path) + return _bootstrap.spec_from_loader(fullname, loader) @@ -203,16 +204,14 @@ index f603a89f7f..d6db040d0d 100644 # Import setup ############################################################### def _fix_up_module(ns, name, pathname, cpathname=None): -@@ -1752,3 +1805,9 @@ +@@ -1752,3 +1806,7 @@ supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) sys.meta_path.append(PathFinder) -+ if sys.platform == "ios": -+ sys.meta_path.append( -+ AppleFrameworkFinder( -+ _path_join(_path_split(sys.executable)[0], "Frameworks") -+ ) -+ ) ++ if sys.platform in {"ios", "tvos", "watchos"}: ++ frameworks_folder = _path_join(_path_split(sys.executable)[0], "Frameworks") ++ _bootstrap._verbose_message('Adding Apple Framework dylib finder at {}', frameworks_folder) ++ sys.meta_path.append(AppleFrameworkFinder(frameworks_folder)) diff --git a/Lib/platform.py b/Lib/platform.py index 9b9d88bf58..6fe084a3a5 100755 --- a/Lib/platform.py