gh-114099 - Add iOS framework loading machinery. (GH-116454)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Russell Keith-Magee 2024-03-19 20:36:19 +08:00 committed by GitHub
parent a557478987
commit 408e127159
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 302 additions and 62 deletions

View file

@ -348,6 +348,17 @@ class CDLL(object):
winmode=None):
if name:
name = _os.fspath(name)
# If the filename that has been provided is an iOS/tvOS/watchOS
# .fwork file, dereference the location to the true origin of the
# binary.
if name.endswith(".fwork"):
with open(name) as f:
name = _os.path.join(
_os.path.dirname(_sys.executable),
f.read().strip()
)
self._name = name
flags = self._func_flags_
if use_errno:

View file

@ -67,7 +67,7 @@ if os.name == "nt":
return fname
return None
elif os.name == "posix" and sys.platform == "darwin":
elif os.name == "posix" and sys.platform in {"darwin", "ios", "tvos", "watchos"}:
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
possible = ['lib%s.dylib' % name,