Skip to content

Commit

Permalink
Add verbose debug for framework loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Sep 28, 2023
1 parent 7554f65 commit 77a7f46
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions patch/Python/Python.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand All @@ -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)


Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 77a7f46

Please sign in to comment.