diff options
author | 2021-02-05 13:00:44 +0200 | |
---|---|---|
committer | 2021-02-05 13:00:44 +0200 | |
commit | 7e09ffe3a7c9b93970073ca35fa7aa3ef9df0a1c (patch) | |
tree | 47b392b2b4c45cb9cce12d3126faabd954da5d5a /lib_pypy | |
parent | use low-level interface where applicable, add at least a minimal hypothesis t... (diff) | |
download | pypy-7e09ffe3a7c9b93970073ca35fa7aa3ef9df0a1c.tar.gz pypy-7e09ffe3a7c9b93970073ca35fa7aa3ef9df0a1c.tar.bz2 pypy-7e09ffe3a7c9b93970073ca35fa7aa3ef9df0a1c.zip |
backport changes from py3.7-big-sur-dyld-cache to default
Diffstat (limited to 'lib_pypy')
-rw-r--r-- | lib_pypy/_ctypes/__init__.py | 21 | ||||
-rw-r--r-- | lib_pypy/pypy_tools/build_cffi_imports.py | 28 |
2 files changed, 31 insertions, 18 deletions
diff --git a/lib_pypy/_ctypes/__init__.py b/lib_pypy/_ctypes/__init__.py index da30f5f6d9..6a0de8d703 100644 --- a/lib_pypy/_ctypes/__init__.py +++ b/lib_pypy/_ctypes/__init__.py @@ -13,15 +13,15 @@ from _ctypes.builtin import ( _string_at_addr, _wstring_at_addr, set_conversion_mode) from _ctypes.union import Union +try: from __pypy__ import builtinify +except ImportError: builtinify = lambda f: f + import os as _os if _os.name in ("nt", "ce"): from _rawffi import FormatError from _rawffi import check_HRESULT as _check_HRESULT - try: from __pypy__ import builtinify - except ImportError: builtinify = lambda f: f - @builtinify def CopyComPointer(src, dst): from ctypes import c_void_p, cast @@ -32,8 +32,6 @@ if _os.name in ("nt", "ce"): dst[0] = cast(src, c_void_p).value return 0 - del builtinify - LoadLibrary = dlopen from _rawffi import FUNCFLAG_STDCALL, FUNCFLAG_CDECL, FUNCFLAG_PYTHONAPI @@ -43,6 +41,19 @@ from _ctypes.builtin import get_errno, set_errno if _os.name in ("nt", "ce"): from _ctypes.builtin import get_last_error, set_last_error +import sys as _sys +if _sys.platform == 'darwin': + try: + from ._ctypes_cffi import lib as _lib + if hasattr(_lib, 'dyld_shared_cache_contains_path'): + @builtinify + def _dyld_shared_cache_contains_path(path): + return _lib.dyld_shared_cache_contains_path(path.encode()) + except ImportError: + pass + +del builtinify + __version__ = '1.1.0' #XXX platform dependant? RTLD_LOCAL = 0 diff --git a/lib_pypy/pypy_tools/build_cffi_imports.py b/lib_pypy/pypy_tools/build_cffi_imports.py index 12e791d695..47b3559310 100644 --- a/lib_pypy/pypy_tools/build_cffi_imports.py +++ b/lib_pypy/pypy_tools/build_cffi_imports.py @@ -1,5 +1,5 @@ from __future__ import print_function -import sys, shutil, os, tempfile, hashlib +import sys, shutil, os, tempfile, hashlib, collections import sysconfig from os.path import join @@ -22,18 +22,20 @@ class MissingDependenciesError(Exception): pass -cffi_build_scripts = { - "_ssl": "_ssl_build.py", - "sqlite3": "_sqlite3_build.py", - "audioop": "_audioop_build.py", - "_tkinter": "_tkinter/tklib_build.py", - "curses": "_curses_build.py" if sys.platform != "win32" else None, - "syslog": "_syslog_build.py" if sys.platform != "win32" else None, - "gdbm": "_gdbm_build.py" if sys.platform != "win32" else None, - "grp": "_pwdgrp_build.py" if sys.platform != "win32" else None, - "resource": "_resource_build.py" if sys.platform != "win32" else None, - "xx": None, # for testing: 'None' should be completely ignored - } +cffi_build_scripts = collections.OrderedDict({ + ("_ctypes._ctypes_cffi", + "_ctypes/_ctypes_build.py" if sys.platform == 'darwin' else None), + ("_ssl": "_ssl_build.py"), + ("sqlite3": "_sqlite3_build.py"), + ("audioop": "_audioop_build.py"), + ("_tkinter": "_tkinter/tklib_build.py"), + ("curses": "_curses_build.py" if sys.platform != "win32" else None), + ("syslog": "_syslog_build.py" if sys.platform != "win32" else None), + ("gdbm": "_gdbm_build.py" if sys.platform != "win32" else None), + ("grp": "_pwdgrp_build.py" if sys.platform != "win32" else None), + ("resource": "_resource_build.py" if sys.platform != "win32" else None), + ("xx": None), # for testing: 'None' should be completely ignored + }) # for distribution, we may want to fetch dependencies not provided by # the OS, such as a recent openssl/libressl. |