python39: updated to 3.9.1
Python 3.9.1 final Core and Builtins bpo-42576: types.GenericAlias will now raise a TypeError when attempting to initialize with a keyword argument. Previously, this would cause the interpreter to crash if the interpreter was compiled with debug symbols. This does not affect interpreters compiled for release. Patch by Ken Jin. Library bpo-5054: CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed. Replace the special purpose getallmatchingheaders with generic get_all method and add relevant tests. bpo-17735: inspect.findsource() now raises OSError instead of IndexError when co_lineno of a code object is greater than the file length. This can happen, for example, when a file is edited after it was imported. bpo-42116: Fix handling of trailing comments by inspect.getsource(). bpo-42487: ChainMap.__iter__ no longer calls __getitem__ on underlying maps bpo-42482: TracebackException no longer holds a reference to the exception’s traceback object. Consequently, instances of TracebackException for equivalent but non-equal exceptions now compare as equal. bpo-42406: We fixed an issue in pickle.whichmodule in which importing multiprocessing could change the how pickle identifies which module an object belongs to, potentially breaking the unpickling of those objects. bpo-34215: Clarify the error message for asyncio.IncompleteReadError when expected is None. bpo-12800: Extracting a symlink from a tarball should succeed and overwrite the symlink if it already exists. The fix is to remove the existing file or symlink before extraction. Based on patch by Chris AtLee, Jeffrey Kintscher, and Senthil Kumaran. Tests bpo-41473: Reenable test_gdb on gdb 9.2 and newer: https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb 10.1. bpo-42553: Fix test_asyncio.test_call_later() race condition: don’t measure asyncio performance in the call_later() unit test. The test failed randomly on the CI. macOS bpo-41116: If no explicit macOS SDK was specified, setup.py should check for Tcl and TK frameworks in /Library/Frameworks; the previous commit inadvertently broke that test. bpo-42504: Fix build on macOS Big Sur when MACOSX_DEPLOYMENT_TARGET=11 IDLE bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround that prevented running files with shortcuts when using new universal2 installers built on macOS 11.
This commit is contained in:
parent
7a810f885f
commit
4554ce77be
29 changed files with 57 additions and 2925 deletions
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.1 2020/10/10 20:19:47 adam Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
VERS= 3.9.0
|
||||
VERS= 3.9.1
|
||||
DISTNAME= python-${VERS}-docs-html
|
||||
PKGNAME= py39-html-docs-${VERS}
|
||||
CATEGORIES= lang python
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: distinfo,v 1.1 2020/10/10 20:19:47 adam Exp $
|
||||
$NetBSD: distinfo,v 1.2 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
SHA1 (python-3.9.0-docs-html.tar.bz2) = 99704717879e3ee4040c2ac7b186b03a56577c8f
|
||||
RMD160 (python-3.9.0-docs-html.tar.bz2) = 3820fc22a919acdca355e56827ca5f87d90d0a70
|
||||
SHA512 (python-3.9.0-docs-html.tar.bz2) = d04957f4895ab8f6bef8467d8b5282e0b3e5c453e2168c25123ee7aefd7a3d6d8b918e9f455bbf82913370a00181b8c00998ec2ae67c763aeda237c5b3a42097
|
||||
Size (python-3.9.0-docs-html.tar.bz2) = 6771373 bytes
|
||||
SHA1 (python-3.9.1-docs-html.tar.bz2) = ab7f5ea13f67b0c7e639964d4be3a83a3c72b35a
|
||||
RMD160 (python-3.9.1-docs-html.tar.bz2) = 172b697e3dad6da7b183124b86b4ce08f1c00db6
|
||||
SHA512 (python-3.9.1-docs-html.tar.bz2) = aa87b27b895894281b923031af651d26627526f85e61fe09c88be081ff6471ae367364cea176b1e522e065c6ec98372504f769aa1d40382716004f90c3761d97
|
||||
Size (python-3.9.1-docs-html.tar.bz2) = 6806786 bytes
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.5 2020/12/07 13:14:39 nia Exp $
|
||||
# $NetBSD: Makefile,v 1.6 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
.include "dist.mk"
|
||||
|
||||
PKGNAME= python39-${PY_DISTVERSION}
|
||||
PKGREVISION= 1
|
||||
CATEGORIES= lang python
|
||||
|
||||
MAINTAINER= pkgsrc-users@NetBSD.org
|
||||
|
@ -65,17 +64,10 @@ PY_PLATNAME= ${LOWER_OPSYS}${OS_VERSION:C/\..*//}
|
|||
.endif
|
||||
PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME:Q}
|
||||
|
||||
# ossaudiodev is only available on x86 for the following platforms
|
||||
PLIST_VARS+= oss
|
||||
.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && \
|
||||
(${PY_PLATNAME} == "linux" || ${OPSYS} == "FreeBSD")
|
||||
PLIST.oss= yes
|
||||
.endif
|
||||
|
||||
# For Xcode 5 and up, we need to search the SDK path for headers, otherwise
|
||||
# certain modules will not be built.
|
||||
.if ${OPSYS} == "Darwin" && exists(${OSX_SDK_PATH:Q}/usr/include)
|
||||
CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include
|
||||
CFLAGS+= -I${OSX_SDK_PATH:Q}/usr/include
|
||||
.endif
|
||||
|
||||
PLIST_VARS+= nis
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@comment $NetBSD: PLIST,v 1.1 2020/10/10 20:19:47 adam Exp $
|
||||
@comment $NetBSD: PLIST,v 1.2 2020/12/08 14:30:40 adam Exp $
|
||||
bin/2to3-${PY_VER_SUFFIX}
|
||||
bin/pydoc${PY_VER_SUFFIX}
|
||||
bin/python${PY_VER_SUFFIX}
|
||||
|
@ -1419,7 +1419,6 @@ lib/python${PY_VER_SUFFIX}/ensurepip/__main__.pyo
|
|||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/__init__.py
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/__init__.pyc
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/__init__.pyo
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/pip-20.2.3-py2.py3-none-any.whl
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl
|
||||
lib/python${PY_VER_SUFFIX}/ensurepip/_uninstall.py
|
||||
|
@ -3281,6 +3280,9 @@ lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_events.pyo
|
|||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures.py
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures.pyc
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures.pyo
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures2.py
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures2.pyc
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_futures2.pyo
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_locks.py
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_locks.pyc
|
||||
lib/python${PY_VER_SUFFIX}/test/test_asyncio/test_locks.pyo
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: dist.mk,v 1.1 2020/10/10 20:19:47 adam Exp $
|
||||
# $NetBSD: dist.mk,v 1.2 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
PY_DISTVERSION= 3.9.0
|
||||
PY_DISTVERSION= 3.9.1
|
||||
DISTNAME= Python-${PY_DISTVERSION}
|
||||
EXTRACT_SUFX= .tar.xz
|
||||
DISTINFO_FILE= ${.CURDIR}/../../lang/python39/distinfo
|
||||
|
|
|
@ -1,42 +1,22 @@
|
|||
$NetBSD: distinfo,v 1.4 2020/11/19 16:29:42 bsiegert Exp $
|
||||
$NetBSD: distinfo,v 1.5 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
SHA1 (Python-3.9.0.tar.xz) = ff1fc8c37d5d4b09ec3bf0d84f3e5b97745c6704
|
||||
RMD160 (Python-3.9.0.tar.xz) = 822fd1ea11f3ca303a08317f6db61f2a1e03e5ef
|
||||
SHA512 (Python-3.9.0.tar.xz) = b141039c9701a8cb0d15cd11a279153077524af4d0599e7d2c7279d4c18d05fda06b33ef82342d875de996c7117b7dc6eb154dc3669d38a1efa99801aeec6c5e
|
||||
Size (Python-3.9.0.tar.xz) = 18866140 bytes
|
||||
SHA1 (patch-Lib___osx__support.py) = 4ccccb81381cd7bf4a8bbc3e376d1234cf2266d5
|
||||
SHA1 (patch-Lib_ctypes_macholib_dyld.py) = d7f3e0c63d6926db253fbe923dd97995478d528c
|
||||
SHA1 (patch-Lib_ctypes_test_test__macholib.py) = bd887357759975b7a497c4079bc730e9c578ceed
|
||||
SHA1 (Python-3.9.1.tar.xz) = 77f4105846f6740297e50d7535a42c02d6b8e7db
|
||||
RMD160 (Python-3.9.1.tar.xz) = 59e056f957252a03c83ce892ac0ef85a274fce58
|
||||
SHA512 (Python-3.9.1.tar.xz) = b90029d6825751685983e9dcf0e0ec9e46f18e6c7d37b0dd7a245a94316f8c0090308ad7c2b2b49ed2514b0b909177231dd5bcad03031bf4624e37136fcf8019
|
||||
Size (Python-3.9.1.tar.xz) = 18897104 bytes
|
||||
SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3
|
||||
SHA1 (patch-Lib_distutils_command_install.py) = 6fc6f5d918b7581fc62cd0fe55857ee932c3a341
|
||||
SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf
|
||||
SHA1 (patch-Lib_distutils_tests_test__build__ext.py) = 145a0f01b3602c582e033081a35d4d86245575f9
|
||||
SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69
|
||||
SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2
|
||||
SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c
|
||||
SHA1 (patch-Lib_test_test__bytes.py) = 72559fdcb09f2c0b0c7b62649c249775d359d72e
|
||||
SHA1 (patch-Lib_test_test__platform.py) = 36311733729ac95159b3177dc0c16e6f4aa2f2b9
|
||||
SHA1 (patch-Lib_test_test__unicode.py) = 14fe4dd1011dbe262459f735a643774e0d38c99e
|
||||
SHA1 (patch-Mac_BuildScript_build-installer.py) = 24641c70facfded736ccc2be069d0e2ae63f63fd
|
||||
SHA1 (patch-Mac_Tools_pythonw.c) = fe128efe942853f0825c1a1fa17842201716dfdf
|
||||
SHA1 (patch-Makefile.pre.in) = d42f9f5bca1dd663f64122dc95b49111452fe6e8
|
||||
SHA1 (patch-Modules___ctypes_callbacks.c) = 95750090d396a647fc12f7f7fad8c591ca4dcdec
|
||||
SHA1 (patch-Modules___ctypes_callproc.c) = 86f27c466a67ebf72d863febece33aa8b1f9f719
|
||||
SHA1 (patch-Modules___ctypes_ctypes.h) = 641c0af4d550c9140549ce2f2df6239c2c954a06
|
||||
SHA1 (patch-Modules___ctypes_malloc__closure.c) = 7e8f491ce66acb6d07e8830ee881edbf0aaac538
|
||||
SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 8d302abacc5737fe7620d4738fff6c5c3ed387c7
|
||||
SHA1 (patch-Modules___zoneinfo.c) = b1df24fe935cd357670a6d9f41245ab04f2015e8
|
||||
SHA1 (patch-Modules_getpath.c) = d7114d21d7d9c7167fad259b115cb02e4153c531
|
||||
SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
|
||||
SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
|
||||
SHA1 (patch-Modules_posixmodule.c) = c592ef4ebe650f672a15ff9887cbeed2ca73b666
|
||||
SHA1 (patch-Modules_socketmodule.c) = 02c447f980a08e2185df78d2f13373574f414304
|
||||
SHA1 (patch-Modules_socketmodule.h) = 61fe96a79d4ccf3e7768eb79dd7e29a50a85328b
|
||||
SHA1 (patch-Modules_timemodule.c) = 8c8e9e43b6d165c1a7df6142a6bcd430003ed165
|
||||
SHA1 (patch-Python_bootstrap__hash.c) = cbc2839675182a344591ba672187b166f166499b
|
||||
SHA1 (patch-Python_pytime.c) = 1bb39b7060c1f337562208dc6611672eaf2f586b
|
||||
SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
|
||||
SHA1 (patch-configure) = 371a65a2cb10fe7709d30a16358b48bc2e0a4aa6
|
||||
SHA1 (patch-configure.ac) = 4ce75ef922e015adf095cb481c829b11c0454efe
|
||||
SHA1 (patch-pyconfig.h.in) = 7c1c997c089f882fbd334b81c04a03dbaebb2c41
|
||||
SHA1 (patch-setup.py) = ab1a7cb97fb8718d21f07f8c896b7de660189c67
|
||||
SHA1 (patch-configure) = 2339ccb9041171f304286b2ee3cf711c7569a7a7
|
||||
SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e
|
||||
SHA1 (patch-setup.py) = 0ea2e4183f7c11ff893ca302aafe8bb9bea80d6c
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
$NetBSD: patch-Lib___osx__support.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/_osx_support.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/_osx_support.py
|
||||
@@ -110,6 +110,26 @@ def _get_system_version():
|
||||
|
||||
return _SYSTEM_VERSION
|
||||
|
||||
+_SYSTEM_VERSION_TUPLE = None
|
||||
+def _get_system_version_tuple():
|
||||
+ """
|
||||
+ Return the macOS system version as a tuple
|
||||
+
|
||||
+ The return value is safe to use to compare
|
||||
+ two version numbers.
|
||||
+ """
|
||||
+ global _SYSTEM_VERSION_TUPLE
|
||||
+ if _SYSTEM_VERSION_TUPLE is None:
|
||||
+ osx_version = _get_system_version()
|
||||
+ if osx_version:
|
||||
+ try:
|
||||
+ _SYSTEM_VERSION_TUPLE = tuple(int(i) for i in osx_version.split('.'))
|
||||
+ except ValueError:
|
||||
+ _SYSTEM_VERSION_TUPLE = ()
|
||||
+
|
||||
+ return _SYSTEM_VERSION_TUPLE
|
||||
+
|
||||
+
|
||||
def _remove_original_values(_config_vars):
|
||||
"""Remove original unmodified values for testing"""
|
||||
# This is needed for higher-level cross-platform tests of get_platform.
|
||||
@@ -132,14 +152,18 @@ def _supports_universal_builds():
|
||||
# builds, in particular -isysroot and -arch arguments to the compiler. This
|
||||
# is in support of allowing 10.4 universal builds to run on 10.3.x systems.
|
||||
|
||||
- osx_version = _get_system_version()
|
||||
- if osx_version:
|
||||
- try:
|
||||
- osx_version = tuple(int(i) for i in osx_version.split('.'))
|
||||
- except ValueError:
|
||||
- osx_version = ''
|
||||
+ osx_version = _get_system_version_tuple()
|
||||
return bool(osx_version >= (10, 4)) if osx_version else False
|
||||
|
||||
+def _supports_arm64_builds():
|
||||
+ """Returns True if arm64 builds are supported on this system"""
|
||||
+ # There are two sets of systems supporting macOS/arm64 builds:
|
||||
+ # 1. macOS 11 and later, unconditionally
|
||||
+ # 2. macOS 10.15 with Xcode 12.2 or later
|
||||
+ # For now the second category is ignored.
|
||||
+ osx_version = _get_system_version_tuple()
|
||||
+ return osx_version >= (11, 0) if osx_version else False
|
||||
+
|
||||
|
||||
def _find_appropriate_compiler(_config_vars):
|
||||
"""Find appropriate C compiler for extension module builds"""
|
||||
@@ -331,6 +355,12 @@ def compiler_fixup(compiler_so, cc_args)
|
||||
except ValueError:
|
||||
break
|
||||
|
||||
+ elif not _supports_arm64_builds():
|
||||
+ # Look for "-arch arm64" and drop that
|
||||
+ for idx in range(len(compiler_so)):
|
||||
+ if compiler_so[idx] == '-arch' and compiler_so[idx+1] == "arm64":
|
||||
+ del compiler_so[idx:idx+2]
|
||||
+
|
||||
if 'ARCHFLAGS' in os.environ and not stripArch:
|
||||
# User specified different -arch flags in the environ,
|
||||
# see also distutils.sysconfig
|
||||
@@ -481,6 +511,8 @@ def get_platform_osx(_config_vars, osnam
|
||||
|
||||
if len(archs) == 1:
|
||||
machine = archs[0]
|
||||
+ elif archs == ('arm64', 'x86_64'):
|
||||
+ machine = 'universal2'
|
||||
elif archs == ('i386', 'ppc'):
|
||||
machine = 'fat'
|
||||
elif archs == ('i386', 'x86_64'):
|
|
@ -1,35 +0,0 @@
|
|||
$NetBSD: patch-Lib_ctypes_macholib_dyld.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/ctypes/macholib/dyld.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/ctypes/macholib/dyld.py
|
||||
@@ -6,6 +6,11 @@ import os
|
||||
from ctypes.macholib.framework import framework_info
|
||||
from ctypes.macholib.dylib import dylib_info
|
||||
from itertools import *
|
||||
+try:
|
||||
+ from _ctypes import _dyld_shared_cache_contains_path
|
||||
+except ImportError:
|
||||
+ def _dyld_shared_cache_contains_path(*args):
|
||||
+ raise NotImplementedError
|
||||
|
||||
__all__ = [
|
||||
'dyld_find', 'framework_find',
|
||||
@@ -122,8 +127,15 @@ def dyld_find(name, executable_path=None
|
||||
dyld_executable_path_search(name, executable_path),
|
||||
dyld_default_search(name, env),
|
||||
), env):
|
||||
+
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
+ try:
|
||||
+ if _dyld_shared_cache_contains_path(path):
|
||||
+ return path
|
||||
+ except NotImplementedError:
|
||||
+ pass
|
||||
+
|
||||
raise ValueError("dylib %s could not be found" % (name,))
|
||||
|
||||
def framework_find(fn, executable_path=None, env=None):
|
|
@ -1,36 +0,0 @@
|
|||
$NetBSD: patch-Lib_ctypes_test_test__macholib.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/ctypes/test/test_macholib.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/ctypes/test/test_macholib.py
|
||||
@@ -45,19 +45,22 @@ def find_lib(name):
|
||||
class MachOTest(unittest.TestCase):
|
||||
@unittest.skipUnless(sys.platform == "darwin", 'OSX-specific test')
|
||||
def test_find(self):
|
||||
-
|
||||
- self.assertEqual(find_lib('pthread'),
|
||||
- '/usr/lib/libSystem.B.dylib')
|
||||
+ # On Mac OS 11, system dylibs are only present in the shared cache,
|
||||
+ # so symlinks like libpthread.dylib -> libSystem.B.dylib will not
|
||||
+ # be resolved by dyld_find
|
||||
+ self.assertIn(find_lib('pthread'),
|
||||
+ ('/usr/lib/libSystem.B.dylib', '/usr/lib/libpthread.dylib'))
|
||||
|
||||
result = find_lib('z')
|
||||
# Issue #21093: dyld default search path includes $HOME/lib and
|
||||
# /usr/local/lib before /usr/lib, which caused test failures if
|
||||
# a local copy of libz exists in one of them. Now ignore the head
|
||||
# of the path.
|
||||
- self.assertRegex(result, r".*/lib/libz\..*.*\.dylib")
|
||||
+ self.assertRegex(result, r".*/lib/libz.*\.dylib")
|
||||
|
||||
- self.assertEqual(find_lib('IOKit'),
|
||||
- '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit')
|
||||
+ self.assertIn(find_lib('IOKit'),
|
||||
+ ('/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit',
|
||||
+ '/System/Library/Frameworks/IOKit.framework/IOKit'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD: patch-Lib_distutils_tests_test__build__ext.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
--- Lib/distutils/tests/test_build_ext.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/distutils/tests/test_build_ext.py
|
||||
@@ -492,7 +492,7 @@ class BuildExtTestCase(TempdirManager,
|
||||
# format the target value as defined in the Apple
|
||||
# Availability Macros. We can't use the macro names since
|
||||
# at least one value we test with will not exist yet.
|
||||
- if target[1] < 10:
|
||||
+ if target[:2] < (10, 10):
|
||||
# for 10.1 through 10.9.x -> "10n0"
|
||||
target = '%02d%01d0' % target
|
||||
else:
|
|
@ -1,15 +0,0 @@
|
|||
$NetBSD: patch-Lib_test_test__bytes.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/test/test_bytes.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/test/test_bytes.py
|
||||
@@ -1034,6 +1034,7 @@ class BytesTest(BaseBytesTest, unittest.
|
||||
c_char_p)
|
||||
|
||||
PyBytes_FromFormat = pythonapi.PyBytes_FromFormat
|
||||
+ PyBytes_FromFormat.argtypes = (c_char_p,)
|
||||
PyBytes_FromFormat.restype = py_object
|
||||
|
||||
# basic tests
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-Lib_test_test__platform.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/test/test_platform.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/test/test_platform.py
|
||||
@@ -245,7 +245,7 @@ class PlatformTest(unittest.TestCase):
|
||||
self.assertEqual(res[1], ('', '', ''))
|
||||
|
||||
if sys.byteorder == 'little':
|
||||
- self.assertIn(res[2], ('i386', 'x86_64'))
|
||||
+ self.assertIn(res[2], ('i386', 'x86_64', 'arm64'))
|
||||
else:
|
||||
self.assertEqual(res[2], 'PowerPC')
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
$NetBSD: patch-Lib_test_test__unicode.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Lib/test/test_unicode.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Lib/test/test_unicode.py
|
||||
@@ -2523,11 +2523,13 @@ class CAPITest(unittest.TestCase):
|
||||
def test_from_format(self):
|
||||
support.import_module('ctypes')
|
||||
from ctypes import (
|
||||
+ c_char_p,
|
||||
pythonapi, py_object, sizeof,
|
||||
c_int, c_long, c_longlong, c_ssize_t,
|
||||
c_uint, c_ulong, c_ulonglong, c_size_t, c_void_p)
|
||||
name = "PyUnicode_FromFormat"
|
||||
_PyUnicode_FromFormat = getattr(pythonapi, name)
|
||||
+ _PyUnicode_FromFormat.argtypes = (c_char_p,)
|
||||
_PyUnicode_FromFormat.restype = py_object
|
||||
|
||||
def PyUnicode_FromFormat(format, *args):
|
|
@ -1,69 +0,0 @@
|
|||
$NetBSD: patch-Mac_BuildScript_build-installer.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Mac/BuildScript/build-installer.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Mac/BuildScript/build-installer.py
|
||||
@@ -116,7 +116,8 @@ WORKDIR = "/tmp/_py"
|
||||
DEPSRC = os.path.join(WORKDIR, 'third-party')
|
||||
DEPSRC = os.path.expanduser('~/Universal/other-sources')
|
||||
|
||||
-universal_opts_map = { '32-bit': ('i386', 'ppc',),
|
||||
+universal_opts_map = { 'universal2': ('arm64', 'x86_64'),
|
||||
+ '32-bit': ('i386', 'ppc',),
|
||||
'64-bit': ('x86_64', 'ppc64',),
|
||||
'intel': ('i386', 'x86_64'),
|
||||
'intel-32': ('i386',),
|
||||
@@ -124,6 +125,7 @@ universal_opts_map = { '32-bit': ('i386'
|
||||
'3-way': ('ppc', 'i386', 'x86_64'),
|
||||
'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
|
||||
default_target_map = {
|
||||
+ 'universal2': '10.9',
|
||||
'64-bit': '10.5',
|
||||
'3-way': '10.5',
|
||||
'intel': '10.5',
|
||||
@@ -190,6 +192,27 @@ EXPECTED_SHARED_LIBS = {}
|
||||
def internalTk():
|
||||
return getDeptargetTuple() >= (10, 6)
|
||||
|
||||
+
|
||||
+def tweak_tcl_build(basedir, archList):
|
||||
+ with open("Makefile", "r") as fp:
|
||||
+ contents = fp.readlines()
|
||||
+
|
||||
+ # For reasons I don't understand the tcl configure script
|
||||
+ # decides that some stdlib symbols aren't present, before
|
||||
+ # deciding that strtod is broken.
|
||||
+ new_contents = []
|
||||
+ for line in contents:
|
||||
+ if line.startswith("COMPAT_OBJS"):
|
||||
+ # note: the space before strtod.o is intentional,
|
||||
+ # the detection of a broken strtod results in
|
||||
+ # "fixstrod.o" on this line.
|
||||
+ for nm in ("strstr.o", "strtoul.o", " strtod.o"):
|
||||
+ line = line.replace(nm, "")
|
||||
+ new_contents.append(line)
|
||||
+
|
||||
+ with open("Makefile", "w") as fp:
|
||||
+ fp.writelines(new_contents)
|
||||
+
|
||||
# List of names of third party software built with this installer.
|
||||
# The names will be inserted into the rtf version of the License.
|
||||
THIRD_PARTY_LIBS = []
|
||||
@@ -231,6 +257,7 @@ def library_recipes():
|
||||
'--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
|
||||
],
|
||||
useLDFlags=False,
|
||||
+ buildrecipe=tweak_tcl_build,
|
||||
install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
|
||||
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
|
||||
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.6'%(getVersion())),
|
||||
@@ -801,6 +828,7 @@ def build_universal_openssl(basedir, arc
|
||||
arch_opts = {
|
||||
"i386": ["darwin-i386-cc"],
|
||||
"x86_64": ["darwin64-x86_64-cc", "enable-ec_nistp_64_gcc_128"],
|
||||
+ "arm64": ["darwin64-arm64-cc"],
|
||||
"ppc": ["darwin-ppc-cc"],
|
||||
"ppc64": ["darwin64-ppc-cc"],
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
$NetBSD: patch-Mac_Tools_pythonw.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Mac/Tools/pythonw.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Mac/Tools/pythonw.c
|
||||
@@ -95,9 +95,6 @@ setup_spawnattr(posix_spawnattr_t* spawn
|
||||
size_t count;
|
||||
cpu_type_t cpu_types[1];
|
||||
short flags = 0;
|
||||
-#ifdef __LP64__
|
||||
- int ch;
|
||||
-#endif
|
||||
|
||||
if ((errno = posix_spawnattr_init(spawnattr)) != 0) {
|
||||
err(2, "posix_spawnattr_int");
|
||||
@@ -119,10 +116,16 @@ setup_spawnattr(posix_spawnattr_t* spawn
|
||||
|
||||
#elif defined(__ppc__)
|
||||
cpu_types[0] = CPU_TYPE_POWERPC;
|
||||
+
|
||||
#elif defined(__i386__)
|
||||
cpu_types[0] = CPU_TYPE_X86;
|
||||
+
|
||||
+#elif defined(__arm64__)
|
||||
+ cpu_types[0] = CPU_TYPE_ARM64;
|
||||
+
|
||||
#else
|
||||
# error "Unknown CPU"
|
||||
+
|
||||
#endif
|
||||
|
||||
if (posix_spawnattr_setbinpref_np(spawnattr, count,
|
||||
@@ -220,7 +223,8 @@ main(int argc, char **argv) {
|
||||
/* We're weak-linking to posix-spawnv to ensure that
|
||||
* an executable build on 10.5 can work on 10.4.
|
||||
*/
|
||||
- if (posix_spawn != NULL) {
|
||||
+
|
||||
+ if (&posix_spawn != NULL) {
|
||||
posix_spawnattr_t spawnattr = NULL;
|
||||
|
||||
setup_spawnattr(&spawnattr);
|
|
@ -1,76 +0,0 @@
|
|||
$NetBSD: patch-Modules___ctypes_callbacks.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/_ctypes/callbacks.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/_ctypes/callbacks.c
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "Python.h"
|
||||
#include "frameobject.h"
|
||||
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
#include <ffi.h>
|
||||
#ifdef MS_WIN32
|
||||
#include <windows.h>
|
||||
@@ -18,7 +20,7 @@ CThunkObject_dealloc(PyObject *myself)
|
||||
Py_XDECREF(self->callable);
|
||||
Py_XDECREF(self->restype);
|
||||
if (self->pcl_write)
|
||||
- ffi_closure_free(self->pcl_write);
|
||||
+ Py_ffi_closure_free(self->pcl_write);
|
||||
PyObject_GC_Del(self);
|
||||
}
|
||||
|
||||
@@ -361,8 +363,7 @@ CThunkObject *_ctypes_alloc_callback(PyO
|
||||
|
||||
assert(CThunk_CheckExact((PyObject *)p));
|
||||
|
||||
- p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure),
|
||||
- &p->pcl_exec);
|
||||
+ p->pcl_write = Py_ffi_closure_alloc(sizeof(ffi_closure), &p->pcl_exec);
|
||||
if (p->pcl_write == NULL) {
|
||||
PyErr_NoMemory();
|
||||
goto error;
|
||||
@@ -408,13 +409,35 @@ CThunkObject *_ctypes_alloc_callback(PyO
|
||||
"ffi_prep_cif failed with %d", result);
|
||||
goto error;
|
||||
}
|
||||
-#if defined(X86_DARWIN) || defined(POWERPC_DARWIN)
|
||||
- result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p);
|
||||
+#if HAVE_FFI_PREP_CLOSURE_LOC
|
||||
+# if USING_APPLE_OS_LIBFFI
|
||||
+# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
||||
+# else
|
||||
+# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME 1
|
||||
+# endif
|
||||
+ if (HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME) {
|
||||
+ result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
|
||||
+ p,
|
||||
+ p->pcl_exec);
|
||||
+ } else
|
||||
+#endif
|
||||
+ {
|
||||
+#if USING_APPLE_OS_LIBFFI && defined(__arm64__)
|
||||
+ PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing");
|
||||
+ goto error;
|
||||
#else
|
||||
- result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
|
||||
- p,
|
||||
- p->pcl_exec);
|
||||
+#ifdef MACOSX
|
||||
+ #pragma clang diagnostic push
|
||||
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
+ result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p);
|
||||
+
|
||||
+#ifdef MACOSX
|
||||
+ #pragma clang diagnostic pop
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
+ }
|
||||
if (result != FFI_OK) {
|
||||
PyErr_Format(PyExc_RuntimeError,
|
||||
"ffi_prep_closure failed with %d", result);
|
|
@ -1,190 +0,0 @@
|
|||
$NetBSD: patch-Modules___ctypes_callproc.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/_ctypes/callproc.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/_ctypes/callproc.c
|
||||
@@ -57,6 +57,8 @@
|
||||
#include "Python.h"
|
||||
#include "structmember.h" // PyMemberDef
|
||||
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
#ifdef MS_WIN32
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
@@ -64,6 +66,10 @@
|
||||
#include "ctypes_dlfcn.h"
|
||||
#endif
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+#include <mach-o/dyld.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef MS_WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -812,7 +818,8 @@ static int _call_function_pointer(int fl
|
||||
ffi_type **atypes,
|
||||
ffi_type *restype,
|
||||
void *resmem,
|
||||
- int argcount)
|
||||
+ int argcount,
|
||||
+ int argtypecount)
|
||||
{
|
||||
PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
|
||||
PyObject *error_object = NULL;
|
||||
@@ -835,14 +842,70 @@ static int _call_function_pointer(int fl
|
||||
if ((flags & FUNCFLAG_CDECL) == 0)
|
||||
cc = FFI_STDCALL;
|
||||
#endif
|
||||
- if (FFI_OK != ffi_prep_cif(&cif,
|
||||
- cc,
|
||||
- argcount,
|
||||
- restype,
|
||||
- atypes)) {
|
||||
- PyErr_SetString(PyExc_RuntimeError,
|
||||
- "ffi_prep_cif failed");
|
||||
- return -1;
|
||||
+
|
||||
+# if USING_APPLE_OS_LIBFFI
|
||||
+# define HAVE_FFI_PREP_CIF_VAR_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
||||
+# elif HAVE_FFI_PREP_CIF_VAR
|
||||
+# define HAVE_FFI_PREP_CIF_VAR_RUNTIME true
|
||||
+# else
|
||||
+# define HAVE_FFI_PREP_CIF_VAR_RUNTIME false
|
||||
+# endif
|
||||
+
|
||||
+ /* Even on Apple-arm64 the calling convention for variadic functions conincides
|
||||
+ * with the standard calling convention in the case that the function called
|
||||
+ * only with its fixed arguments. Thus, we do not need a special flag to be
|
||||
+ * set on variadic functions. We treat a function as variadic if it is called
|
||||
+ * with a nonzero number of variadic arguments */
|
||||
+ bool is_variadic = (argtypecount != 0 && argcount > argtypecount);
|
||||
+ (void) is_variadic;
|
||||
+
|
||||
+#if defined(__APPLE__) && defined(__arm64__)
|
||||
+ if (is_variadic) {
|
||||
+ if (HAVE_FFI_PREP_CIF_VAR_RUNTIME) {
|
||||
+ } else {
|
||||
+ PyErr_SetString(PyExc_NotImplementedError, "ffi_prep_cif_var() is missing");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+#if HAVE_FFI_PREP_CIF_VAR
|
||||
+ if (is_variadic) {
|
||||
+ if (HAVE_FFI_PREP_CIF_VAR_RUNTIME) {
|
||||
+ if (FFI_OK != ffi_prep_cif_var(&cif,
|
||||
+ cc,
|
||||
+ argtypecount,
|
||||
+ argcount,
|
||||
+ restype,
|
||||
+ atypes)) {
|
||||
+ PyErr_SetString(PyExc_RuntimeError,
|
||||
+ "ffi_prep_cif_var failed");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (FFI_OK != ffi_prep_cif(&cif,
|
||||
+ cc,
|
||||
+ argcount,
|
||||
+ restype,
|
||||
+ atypes)) {
|
||||
+ PyErr_SetString(PyExc_RuntimeError,
|
||||
+ "ffi_prep_cif failed");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ } else
|
||||
+#endif
|
||||
+
|
||||
+ {
|
||||
+ if (FFI_OK != ffi_prep_cif(&cif,
|
||||
+ cc,
|
||||
+ argcount,
|
||||
+ restype,
|
||||
+ atypes)) {
|
||||
+ PyErr_SetString(PyExc_RuntimeError,
|
||||
+ "ffi_prep_cif failed");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) {
|
||||
@@ -1212,9 +1275,8 @@ PyObject *_ctypes_callproc(PPROC pProc,
|
||||
|
||||
if (-1 == _call_function_pointer(flags, pProc, avalues, atypes,
|
||||
rtype, resbuf,
|
||||
- Py_SAFE_DOWNCAST(argcount,
|
||||
- Py_ssize_t,
|
||||
- int)))
|
||||
+ Py_SAFE_DOWNCAST(argcount, Py_ssize_t, int),
|
||||
+ Py_SAFE_DOWNCAST(argtype_count, Py_ssize_t, int)))
|
||||
goto cleanup;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
@@ -1398,6 +1460,42 @@ copy_com_pointer(PyObject *self, PyObjec
|
||||
}
|
||||
#else
|
||||
|
||||
+#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
|
||||
+static PyObject *py_dyld_shared_cache_contains_path(PyObject *self, PyObject *args)
|
||||
+{
|
||||
+ PyObject *name, *name2;
|
||||
+ char *name_str;
|
||||
+
|
||||
+ if (__builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)) {
|
||||
+ int r;
|
||||
+
|
||||
+ if (!PyArg_ParseTuple(args, "O", &name))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (name == Py_None)
|
||||
+ Py_RETURN_FALSE;
|
||||
+
|
||||
+ if (PyUnicode_FSConverter(name, &name2) == 0)
|
||||
+ return NULL;
|
||||
+ name_str = PyBytes_AS_STRING(name2);
|
||||
+
|
||||
+ r = _dyld_shared_cache_contains_path(name_str);
|
||||
+ Py_DECREF(name2);
|
||||
+
|
||||
+ if (r) {
|
||||
+ Py_RETURN_TRUE;
|
||||
+ } else {
|
||||
+ Py_RETURN_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ } else {
|
||||
+ PyErr_SetString(PyExc_NotImplementedError, "_dyld_shared_cache_contains_path symbol is missing");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
static PyObject *py_dl_open(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *name, *name2;
|
||||
@@ -1887,6 +1985,8 @@ buffer_info(PyObject *self, PyObject *ar
|
||||
return Py_BuildValue("siN", dict->format, dict->ndim, shape);
|
||||
}
|
||||
|
||||
+
|
||||
+
|
||||
PyMethodDef _ctypes_module_methods[] = {
|
||||
{"get_errno", get_errno, METH_NOARGS},
|
||||
{"set_errno", set_errno, METH_VARARGS},
|
||||
@@ -1909,6 +2009,9 @@ PyMethodDef _ctypes_module_methods[] = {
|
||||
{"dlclose", py_dl_close, METH_VARARGS, "dlclose a library"},
|
||||
{"dlsym", py_dl_sym, METH_VARARGS, "find symbol in shared library"},
|
||||
#endif
|
||||
+#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
|
||||
+ {"_dyld_shared_cache_contains_path", py_dyld_shared_cache_contains_path, METH_VARARGS, "check if path is in the shared cache"},
|
||||
+#endif
|
||||
{"alignment", align_func, METH_O, alignment_doc},
|
||||
{"sizeof", sizeof_func, METH_O, sizeof_doc},
|
||||
{"byref", byref, METH_VARARGS, byref_doc},
|
|
@ -1,22 +0,0 @@
|
|||
$NetBSD: patch-Modules___ctypes_ctypes.h,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/_ctypes/ctypes.h.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/_ctypes/ctypes.h
|
||||
@@ -366,6 +366,14 @@ PyObject *_ctypes_get_errobj(int **pspac
|
||||
extern PyObject *ComError;
|
||||
#endif
|
||||
|
||||
+#if USING_MALLOC_CLOSURE_DOT_C
|
||||
+void Py_ffi_closure_free(void *p);
|
||||
+void *Py_ffi_closure_alloc(size_t size, void** codeloc);
|
||||
+#else
|
||||
+#define Py_ffi_closure_free ffi_closure_free
|
||||
+#define Py_ffi_closure_alloc ffi_closure_alloc
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
Local Variables:
|
||||
compile-command: "python setup.py -q build install --home ~"
|
|
@ -1,37 +0,0 @@
|
|||
$NetBSD: patch-Modules___ctypes_malloc__closure.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/_ctypes/malloc_closure.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/_ctypes/malloc_closure.c
|
||||
@@ -89,16 +89,27 @@ static void more_core(void)
|
||||
/******************************************************************/
|
||||
|
||||
/* put the item back into the free list */
|
||||
-void ffi_closure_free(void *p)
|
||||
+void Py_ffi_closure_free(void *p)
|
||||
{
|
||||
+#if USING_APPLE_OS_LIBFFI && HAVE_FFI_CLOSURE_ALLOC
|
||||
+ if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
||||
+ ffi_closure_free(p);
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
ITEM *item = (ITEM *)p;
|
||||
item->next = free_list;
|
||||
free_list = item;
|
||||
}
|
||||
|
||||
/* return one item from the free list, allocating more if needed */
|
||||
-void *ffi_closure_alloc(size_t ignored, void** codeloc)
|
||||
+void *Py_ffi_closure_alloc(size_t size, void** codeloc)
|
||||
{
|
||||
+#if USING_APPLE_OS_LIBFFI && HAVE_FFI_CLOSURE_ALLOC
|
||||
+ if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
||||
+ return ffi_closure_alloc(size, codeloc);
|
||||
+ }
|
||||
+#endif
|
||||
ITEM *item;
|
||||
if (!free_list)
|
||||
more_core();
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-Modules___decimal_libmpdec_mpdecimal.h,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). (Original code.)
|
||||
|
||||
--- Modules/_decimal/libmpdec/mpdecimal.h.orig 2020-11-11 21:56:51.000000000 +0000
|
||||
+++ Modules/_decimal/libmpdec/mpdecimal.h
|
||||
@@ -121,6 +121,9 @@ const char *mpd_version(void);
|
||||
#elif defined(__x86_64__)
|
||||
#define CONFIG_64
|
||||
#define ASM
|
||||
+ #elif defined(__aarch64__)
|
||||
+ #define CONFIG_64
|
||||
+ #define ANSI
|
||||
#else
|
||||
#error "unknown architecture for universal build."
|
||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||
$NetBSD: patch-Modules_getpath.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/getpath.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/getpath.c
|
||||
@@ -923,11 +923,7 @@ static PyStatus
|
||||
calculate_program_macos(wchar_t **abs_path_p)
|
||||
{
|
||||
char execpath[MAXPATHLEN + 1];
|
||||
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
uint32_t nsexeclength = Py_ARRAY_LENGTH(execpath) - 1;
|
||||
-#else
|
||||
- unsigned long nsexeclength = Py_ARRAY_LENGTH(execpath) - 1;
|
||||
-#endif
|
||||
|
||||
/* On Mac OS X, if a script uses an interpreter of the form
|
||||
"#!/opt/python2.3/bin/python", the kernel only passes "python"
|
File diff suppressed because it is too large
Load diff
|
@ -1,322 +0,0 @@
|
|||
$NetBSD: patch-Modules_timemodule.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Modules/timemodule.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Modules/timemodule.c
|
||||
@@ -51,6 +51,15 @@
|
||||
#define _Py_tzname tzname
|
||||
#endif
|
||||
|
||||
+#if defined(__APPLE__ ) && defined(__has_builtin)
|
||||
+# if __has_builtin(__builtin_available)
|
||||
+# define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
|
||||
+# endif
|
||||
+#endif
|
||||
+#ifndef HAVE_CLOCK_GETTIME_RUNTIME
|
||||
+# define HAVE_CLOCK_GETTIME_RUNTIME 1
|
||||
+#endif
|
||||
+
|
||||
#define SEC_TO_NS (1000 * 1000 * 1000)
|
||||
|
||||
/* Forward declarations */
|
||||
@@ -149,6 +158,16 @@ perf_counter(_Py_clock_info_t *info)
|
||||
}
|
||||
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+/*
|
||||
+ * The clock_* functions will be removed from the module
|
||||
+ * dict entirely when the C API is not available.
|
||||
+ */
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
+#endif
|
||||
+
|
||||
static PyObject *
|
||||
time_clock_gettime(PyObject *self, PyObject *args)
|
||||
{
|
||||
@@ -297,6 +316,11 @@ PyDoc_STRVAR(clock_getres_doc,
|
||||
"clock_getres(clk_id) -> floating point number\n\
|
||||
\n\
|
||||
Return the resolution (precision) of the specified clock clk_id.");
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+#pragma clang diagnostic pop
|
||||
+#endif
|
||||
+
|
||||
#endif /* HAVE_CLOCK_GETRES */
|
||||
|
||||
#ifdef HAVE_PTHREAD_GETCPUCLOCKID
|
||||
@@ -1162,31 +1186,35 @@ _PyTime_GetProcessTimeWithInfo(_PyTime_t
|
||||
#if defined(HAVE_CLOCK_GETTIME) \
|
||||
&& (defined(CLOCK_PROCESS_CPUTIME_ID) || defined(CLOCK_PROF))
|
||||
struct timespec ts;
|
||||
+
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
+
|
||||
#ifdef CLOCK_PROF
|
||||
- const clockid_t clk_id = CLOCK_PROF;
|
||||
- const char *function = "clock_gettime(CLOCK_PROF)";
|
||||
+ const clockid_t clk_id = CLOCK_PROF;
|
||||
+ const char *function = "clock_gettime(CLOCK_PROF)";
|
||||
#else
|
||||
- const clockid_t clk_id = CLOCK_PROCESS_CPUTIME_ID;
|
||||
- const char *function = "clock_gettime(CLOCK_PROCESS_CPUTIME_ID)";
|
||||
+ const clockid_t clk_id = CLOCK_PROCESS_CPUTIME_ID;
|
||||
+ const char *function = "clock_gettime(CLOCK_PROCESS_CPUTIME_ID)";
|
||||
#endif
|
||||
|
||||
- if (clock_gettime(clk_id, &ts) == 0) {
|
||||
- if (info) {
|
||||
- struct timespec res;
|
||||
- info->implementation = function;
|
||||
- info->monotonic = 1;
|
||||
- info->adjustable = 0;
|
||||
- if (clock_getres(clk_id, &res)) {
|
||||
- PyErr_SetFromErrno(PyExc_OSError);
|
||||
- return -1;
|
||||
+ if (clock_gettime(clk_id, &ts) == 0) {
|
||||
+ if (info) {
|
||||
+ struct timespec res;
|
||||
+ info->implementation = function;
|
||||
+ info->monotonic = 1;
|
||||
+ info->adjustable = 0;
|
||||
+ if (clock_getres(clk_id, &res)) {
|
||||
+ PyErr_SetFromErrno(PyExc_OSError);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
|
||||
}
|
||||
- info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
|
||||
- }
|
||||
|
||||
- if (_PyTime_FromTimespec(tp, &ts) < 0) {
|
||||
- return -1;
|
||||
+ if (_PyTime_FromTimespec(tp, &ts) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
}
|
||||
- return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1373,6 +1401,16 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
|
||||
|
||||
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
|
||||
#define HAVE_THREAD_TIME
|
||||
+
|
||||
+#if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
|
||||
+static int
|
||||
+_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
|
||||
+ __attribute__((availability(macos, introduced=10.12)))
|
||||
+ __attribute__((availability(ios, introduced=10.0)))
|
||||
+ __attribute__((availability(tvos, introduced=10.0)))
|
||||
+ __attribute__((availability(watchos, introduced=3.0)));
|
||||
+#endif
|
||||
+
|
||||
static int
|
||||
_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
|
||||
{
|
||||
@@ -1404,6 +1442,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREAD_TIME
|
||||
+#ifdef __APPLE__
|
||||
+/*
|
||||
+ * The clock_* functions will be removed from the module
|
||||
+ * dict entirely when the C API is not available.
|
||||
+ */
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
+#endif
|
||||
+
|
||||
static PyObject *
|
||||
time_thread_time(PyObject *self, PyObject *unused)
|
||||
{
|
||||
@@ -1434,6 +1481,11 @@ PyDoc_STRVAR(thread_time_ns_doc,
|
||||
\n\
|
||||
Thread time for profiling as nanoseconds:\n\
|
||||
sum of the kernel and user-space CPU time.");
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+#pragma clang diagnostic pop
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1483,9 +1535,19 @@ time_get_clock_info(PyObject *self, PyOb
|
||||
}
|
||||
#ifdef HAVE_THREAD_TIME
|
||||
else if (strcmp(name, "thread_time") == 0) {
|
||||
- if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) {
|
||||
+
|
||||
+#ifdef __APPLE__
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
+#endif
|
||||
+ if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#ifdef __APPLE__
|
||||
+ } else {
|
||||
+ PyErr_SetString(PyExc_ValueError, "unknown clock");
|
||||
return NULL;
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
@@ -1766,68 +1828,116 @@ if it is -1, mktime() should guess based
|
||||
static int
|
||||
time_exec(PyObject *module)
|
||||
{
|
||||
+#if defined(__APPLE__) && defined(HAVE_CLOCK_GETTIME)
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
+ /* pass: ^^^ cannot use '!' here */
|
||||
+ } else {
|
||||
+ PyObject* dct = PyModule_GetDict(module);
|
||||
+ if (dct == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (PyDict_DelItemString(dct, "clock_gettime") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ if (PyDict_DelItemString(dct, "clock_gettime_ns") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ if (PyDict_DelItemString(dct, "clock_settime") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ if (PyDict_DelItemString(dct, "clock_settime_ns") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ if (PyDict_DelItemString(dct, "clock_getres") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined(__APPLE__) && defined(HAVE_THREAD_TIME)
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
+ /* pass: ^^^ cannot use '!' here */
|
||||
+ } else {
|
||||
+ PyObject* dct = PyModule_GetDict(module);
|
||||
+
|
||||
+ if (PyDict_DelItemString(dct, "thread_time") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ if (PyDict_DelItemString(dct, "thread_time_ns") == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
/* Set, or reset, module variables like time.timezone */
|
||||
if (init_timezone(module) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
|
||||
#ifdef CLOCK_REALTIME
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_REALTIME) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_REALTIME) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
+
|
||||
#ifdef CLOCK_MONOTONIC
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_MONOTONIC) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_MONOTONIC) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
#endif
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_MONOTONIC_RAW) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_MONOTONIC_RAW) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
+
|
||||
#ifdef CLOCK_HIGHRES
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_HIGHRES) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_HIGHRES) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_PROCESS_CPUTIME_ID
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_PROCESS_CPUTIME_ID) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_PROCESS_CPUTIME_ID) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
+
|
||||
#ifdef CLOCK_THREAD_CPUTIME_ID
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_THREAD_CPUTIME_ID) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_THREAD_CPUTIME_ID) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_PROF
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_PROF) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_PROF) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_BOOTTIME
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_BOOTTIME) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_BOOTTIME) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_TAI
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_TAI) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_TAI) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_UPTIME
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_UPTIME) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_UPTIME) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef CLOCK_UPTIME_RAW
|
||||
- if (PyModule_AddIntMacro(module, CLOCK_UPTIME_RAW) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
+
|
||||
+ if (PyModule_AddIntMacro(module, CLOCK_UPTIME_RAW) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
+ }
|
||||
|
||||
#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
$NetBSD: patch-Python_bootstrap__hash.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Python/bootstrap_hash.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Python/bootstrap_hash.c
|
||||
@@ -25,6 +25,16 @@
|
||||
# include <sanitizer/msan_interface.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__APPLE__) && defined(__has_builtin)
|
||||
+# if __has_builtin(__builtin_available)
|
||||
+# define HAVE_GETENTRYPY_GETRANDOM_RUNTIME __builtin_available(macOS 10.12, iOS 10.10, tvOS 10.0, watchOS 3.0, *)
|
||||
+# endif
|
||||
+#endif
|
||||
+#ifndef HAVE_GETENTRYPY_GETRANDOM_RUNTIME
|
||||
+# define HAVE_GETENTRYPY_GETRANDOM_RUNTIME 1
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
#ifdef Py_DEBUG
|
||||
int _Py_HashSecret_Initialized = 0;
|
||||
#else
|
||||
@@ -208,6 +218,16 @@ py_getrandom(void *buffer, Py_ssize_t si
|
||||
error.
|
||||
|
||||
getentropy() is retried if it failed with EINTR: interrupted by a signal. */
|
||||
+
|
||||
+#if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
|
||||
+static int
|
||||
+py_getentropy(char *buffer, Py_ssize_t size, int raise)
|
||||
+ __attribute__((availability(macos,introduced=10.12)))
|
||||
+ __attribute__((availability(ios,introduced=10.0)))
|
||||
+ __attribute__((availability(tvos,introduced=10.0)))
|
||||
+ __attribute__((availability(watchos,introduced=3.0)));
|
||||
+#endif
|
||||
+
|
||||
static int
|
||||
py_getentropy(char *buffer, Py_ssize_t size, int raise)
|
||||
{
|
||||
@@ -498,19 +518,21 @@ pyurandom(void *buffer, Py_ssize_t size,
|
||||
#else
|
||||
|
||||
#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY)
|
||||
+ if (HAVE_GETENTRYPY_GETRANDOM_RUNTIME) {
|
||||
#ifdef PY_GETRANDOM
|
||||
- res = py_getrandom(buffer, size, blocking, raise);
|
||||
+ res = py_getrandom(buffer, size, blocking, raise);
|
||||
#else
|
||||
- res = py_getentropy(buffer, size, raise);
|
||||
+ res = py_getentropy(buffer, size, raise);
|
||||
#endif
|
||||
- if (res < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
- if (res == 1) {
|
||||
- return 0;
|
||||
- }
|
||||
- /* getrandom() or getentropy() function is not available: failed with
|
||||
- ENOSYS or EPERM. Fall back on reading from /dev/urandom. */
|
||||
+ if (res < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (res == 1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* getrandom() or getentropy() function is not available: failed with
|
||||
+ ENOSYS or EPERM. Fall back on reading from /dev/urandom. */
|
||||
+ } /* end of availability block */
|
||||
#endif
|
||||
|
||||
return dev_urandom(buffer, size, raise);
|
|
@ -1,73 +0,0 @@
|
|||
$NetBSD: patch-Python_pytime.c,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- Python/pytime.c.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ Python/pytime.c
|
||||
@@ -5,6 +5,12 @@
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <mach/mach_time.h> /* mach_absolute_time(), mach_timebase_info() */
|
||||
+
|
||||
+#if defined(__APPLE__) && defined(__has_builtin)
|
||||
+# if __has_builtin(__builtin_available)
|
||||
+# define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
|
||||
+# endif
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
#define _PyTime_check_mul_overflow(a, b) \
|
||||
@@ -683,15 +689,22 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_
|
||||
|
||||
#else /* MS_WINDOWS */
|
||||
int err;
|
||||
-#ifdef HAVE_CLOCK_GETTIME
|
||||
+#if defined(HAVE_CLOCK_GETTIME)
|
||||
struct timespec ts;
|
||||
-#else
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(HAVE_CLOCK_GETTIME) || defined(__APPLE__)
|
||||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
assert(info == NULL || raise);
|
||||
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
+
|
||||
+#ifdef HAVE_CLOCK_GETTIME_RUNTIME
|
||||
+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
|
||||
+#endif
|
||||
+
|
||||
err = clock_gettime(CLOCK_REALTIME, &ts);
|
||||
if (err) {
|
||||
if (raise) {
|
||||
@@ -715,7 +728,14 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_
|
||||
info->resolution = 1e-9;
|
||||
}
|
||||
}
|
||||
-#else /* HAVE_CLOCK_GETTIME */
|
||||
+
|
||||
+#ifdef HAVE_CLOCK_GETTIME_RUNTIME
|
||||
+ } else {
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_GETTIME_RUNTIME)
|
||||
|
||||
/* test gettimeofday() */
|
||||
err = gettimeofday(&tv, (struct timezone *)NULL);
|
||||
@@ -735,6 +755,11 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_
|
||||
info->monotonic = 0;
|
||||
info->adjustable = 1;
|
||||
}
|
||||
+
|
||||
+#if defined(HAVE_CLOCK_GETTIME_RUNTIME) && defined(HAVE_CLOCK_GETTIME)
|
||||
+ } /* end of availibity block */
|
||||
+#endif
|
||||
+
|
||||
#endif /* !HAVE_CLOCK_GETTIME */
|
||||
#endif /* !MS_WINDOWS */
|
||||
return 0;
|
|
@ -1,34 +1,13 @@
|
|||
$NetBSD: patch-configure,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
||||
$NetBSD: patch-configure,v 1.3 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
- Use gnu99 instead of c99 to avoid "alloca() undefined" problems.
|
||||
- Fix linking on Darwin; don't use -stack_size.
|
||||
- Changes for consistency across pkgsrc platforms.
|
||||
- Simplify _sysconfigdata to include only platform name.
|
||||
- Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
Use gnu99 instead of c99 to avoid "alloca() undefined" problems.
|
||||
Fix linking on Darwin; don't use -stack_size.
|
||||
Changes for consistency across pkgsrc platforms.
|
||||
Simplify _sysconfigdata to include only platform name.
|
||||
|
||||
--- configure.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
--- configure.orig 2020-12-07 14:02:38.000000000 +0000
|
||||
+++ configure
|
||||
@@ -1510,8 +1510,8 @@ Optional Packages:
|
||||
specify the kind of universal binary that should be
|
||||
created. this option is only valid when
|
||||
--enable-universalsdk is set; options are:
|
||||
- ("32-bit", "64-bit", "3-way", "intel", "intel-32",
|
||||
- "intel-64", or "all") see Mac/README.rst
|
||||
+ ("universal2", "32-bit", "64-bit", "3-way", "intel",
|
||||
+ "intel-32", "intel-64", or "all") see Mac/README.rst
|
||||
--with-framework-name=FRAMEWORK
|
||||
specify the name for the python framework on macOS
|
||||
only valid when --enable-framework is set. see
|
||||
@@ -6954,14 +6954,14 @@ fi
|
||||
|
||||
|
||||
|
||||
-# The -arch flags for universal builds on OSX
|
||||
+# The -arch flags for universal builds on macOS
|
||||
UNIVERSAL_ARCH_FLAGS=
|
||||
|
||||
|
||||
@@ -6961,7 +6961,7 @@ UNIVERSAL_ARCH_FLAGS=
|
||||
# tweak BASECFLAGS based on compiler and platform
|
||||
case $GCC in
|
||||
yes)
|
||||
|
@ -37,51 +16,7 @@ $NetBSD: patch-configure,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
|||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
|
||||
$as_echo_n "checking for -Wextra... " >&6; }
|
||||
@@ -7481,6 +7481,11 @@ $as_echo "$CC" >&6; }
|
||||
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
;;
|
||||
+ universal2)
|
||||
+ UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
|
||||
+ LIPO_32BIT_FLAGS=""
|
||||
+ ARCH_RUN_32BIT="true"
|
||||
+ ;;
|
||||
intel)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS="-extract i386"
|
||||
@@ -7502,7 +7507,7 @@ $as_echo "$CC" >&6; }
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
;;
|
||||
*)
|
||||
- as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
|
||||
+ as_fn_error $? "proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -9334,7 +9339,7 @@ fi
|
||||
MACOSX_DEFAULT_ARCH="ppc"
|
||||
;;
|
||||
*)
|
||||
- as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
|
||||
+ as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@@ -9344,9 +9349,12 @@ fi
|
||||
;;
|
||||
ppc)
|
||||
MACOSX_DEFAULT_ARCH="ppc64"
|
||||
+ ;;
|
||||
+ arm64)
|
||||
+ MACOSX_DEFAULT_ARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
- as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
|
||||
+ as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -9617,7 +9625,6 @@ then
|
||||
@@ -9650,7 +9650,6 @@ then
|
||||
# to ensure that tests don't crash
|
||||
# Note: This matches the value of THREAD_STACK_SIZE in
|
||||
# thread_pthread.h
|
||||
|
@ -89,39 +24,7 @@ $NetBSD: patch-configure,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
|||
|
||||
if test "$enable_framework"
|
||||
then
|
||||
@@ -11989,6 +11996,31 @@ $as_echo "no" >&6; }
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _dyld_shared_cache_contains_path" >&5
|
||||
+$as_echo_n "checking for _dyld_shared_cache_contains_path... " >&6; }
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+#include <mach-o/dyld.h>
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+void *x=_dyld_shared_cache_contains_path
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_compile "$LINENO"; then :
|
||||
+
|
||||
+$as_echo "#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1" >>confdefs.h
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+else
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for memfd_create" >&5
|
||||
$as_echo_n "checking for memfd_create... " >&6; }
|
||||
@@ -14437,10 +14469,10 @@ _ACEOF
|
||||
@@ -14495,10 +14494,10 @@ _ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
|
||||
|
@ -134,7 +37,7 @@ $NetBSD: patch-configure,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
|||
if test "$ax_cv_c_float_words_bigendian" = unknown; then
|
||||
ax_cv_c_float_words_bigendian=no
|
||||
else
|
||||
@@ -15326,8 +15358,6 @@ fi
|
||||
@@ -15384,8 +15383,6 @@ fi
|
||||
|
||||
|
||||
case $ac_sys_system in
|
||||
|
@ -143,7 +46,7 @@ $NetBSD: patch-configure,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
|||
*)
|
||||
EXT_SUFFIX=${SHLIB_SUFFIX};;
|
||||
esac
|
||||
@@ -15383,11 +15413,7 @@ fi
|
||||
@@ -15441,11 +15438,7 @@ fi
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
$NetBSD: patch-configure.ac,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
|
||||
|
||||
Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
|
||||
--- configure.ac.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ configure.ac
|
||||
@@ -218,7 +218,7 @@ AC_ARG_WITH(universal-archs,
|
||||
AS_HELP_STRING([--with-universal-archs=ARCH],
|
||||
[specify the kind of universal binary that should be created. this option is
|
||||
only valid when --enable-universalsdk is set; options are:
|
||||
- ("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")
|
||||
+ ("universal2", "32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")
|
||||
see Mac/README.rst]),
|
||||
[
|
||||
UNIVERSAL_ARCHS="$withval"
|
||||
@@ -1587,7 +1587,7 @@ AC_SUBST(BASECFLAGS)
|
||||
AC_SUBST(CFLAGS_NODIST)
|
||||
AC_SUBST(LDFLAGS_NODIST)
|
||||
|
||||
-# The -arch flags for universal builds on OSX
|
||||
+# The -arch flags for universal builds on macOS
|
||||
UNIVERSAL_ARCH_FLAGS=
|
||||
AC_SUBST(UNIVERSAL_ARCH_FLAGS)
|
||||
|
||||
@@ -1888,6 +1888,11 @@ yes)
|
||||
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
;;
|
||||
+ universal2)
|
||||
+ UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
|
||||
+ LIPO_32BIT_FLAGS=""
|
||||
+ ARCH_RUN_32BIT="true"
|
||||
+ ;;
|
||||
intel)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS="-extract i386"
|
||||
@@ -1909,7 +1914,7 @@ yes)
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
;;
|
||||
*)
|
||||
- AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
|
||||
+ AC_MSG_ERROR([proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way])
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2479,7 +2484,7 @@ case $ac_sys_system/$ac_sys_release in
|
||||
MACOSX_DEFAULT_ARCH="ppc"
|
||||
;;
|
||||
*)
|
||||
- AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
|
||||
+ AC_MSG_ERROR([Unexpected output of 'arch' on macOS])
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@@ -2489,9 +2494,12 @@ case $ac_sys_system/$ac_sys_release in
|
||||
;;
|
||||
ppc)
|
||||
MACOSX_DEFAULT_ARCH="ppc64"
|
||||
+ ;;
|
||||
+ arm64)
|
||||
+ MACOSX_DEFAULT_ARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
- AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
|
||||
+ AC_MSG_ERROR([Unexpected output of 'arch' on macOS])
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -3770,6 +3778,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
])
|
||||
+AC_MSG_CHECKING(for _dyld_shared_cache_contains_path)
|
||||
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach-o/dyld.h>]], [[void *x=_dyld_shared_cache_contains_path]])],
|
||||
+ [AC_DEFINE(HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH, 1, Define if you have the '_dyld_shared_cache_contains_path' function.)
|
||||
+ AC_MSG_RESULT(yes)],
|
||||
+ [AC_MSG_RESULT(no)
|
||||
+])
|
||||
|
||||
AC_MSG_CHECKING(for memfd_create)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
@ -1,8 +1,6 @@
|
|||
$NetBSD: patch-pyconfig.h.in,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
||||
$NetBSD: patch-pyconfig.h.in,v 1.3 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
- detect netcan/can.h on NetBSD
|
||||
- Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
Detect netcan/can.h on NetBSD
|
||||
|
||||
--- pyconfig.h.in.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
+++ pyconfig.h.in
|
||||
|
@ -16,13 +14,3 @@ $NetBSD: patch-pyconfig.h.in,v 1.2 2020/11/12 10:58:21 sjmulder Exp $
|
|||
/* Define to 1 if you have the <linux/netlink.h> header file. */
|
||||
#undef HAVE_LINUX_NETLINK_H
|
||||
|
||||
@@ -778,6 +781,9 @@
|
||||
/* Define if you have the 'prlimit' functions. */
|
||||
#undef HAVE_PRLIMIT
|
||||
|
||||
+/* Define if you have the '_dyld_shared_cache_contains_path' function. */
|
||||
+#undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
|
||||
+
|
||||
/* Define to 1 if you have the <process.h> header file. */
|
||||
#undef HAVE_PROCESS_H
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
$NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
||||
$NetBSD: patch-setup.py,v 1.4 2020/12/08 14:30:40 adam Exp $
|
||||
|
||||
- Disable certain modules, so they can be built as separate packages.
|
||||
- Do not look for ncursesw.
|
||||
- Assume panel_library is correct; this is a fix for ncurses' gnupanel
|
||||
which will get transformed to panel in buildlink.
|
||||
- Also look for uuid/uuid.h.
|
||||
- Support for macOS 11 and Apple Silicon (ARM). Backported from:
|
||||
https://github.com/python/cpython/pull/22855
|
||||
Disable certain modules, so they can be built as separate packages.
|
||||
Do not look for ncursesw.
|
||||
Assume panel_library is correct; this is a fix for ncurses' gnupanel
|
||||
which will get transformed to panel in buildlink.
|
||||
Also look for uuid/uuid.h.
|
||||
|
||||
--- setup.py.orig 2020-10-05 15:07:58.000000000 +0000
|
||||
--- setup.py.orig 2020-12-07 14:02:38.000000000 +0000
|
||||
+++ setup.py
|
||||
@@ -29,7 +29,7 @@ except ImportError:
|
||||
@@ -30,7 +30,7 @@ except ImportError:
|
||||
SUBPROCESS_BOOTSTRAP = True
|
||||
|
||||
|
||||
|
@ -19,7 +17,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
from distutils.command.build_ext import build_ext
|
||||
from distutils.command.build_scripts import build_scripts
|
||||
from distutils.command.install import install
|
||||
@@ -43,7 +43,7 @@ from distutils.spawn import find_executa
|
||||
@@ -44,7 +44,7 @@ from distutils.spawn import find_executa
|
||||
TEST_EXTENSIONS = True
|
||||
|
||||
# This global variable is used to hold the list of modules to be disabled.
|
||||
|
@ -28,9 +26,9 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
|
||||
|
||||
def get_platform():
|
||||
@@ -239,6 +239,16 @@ def is_macosx_sdk_path(path):
|
||||
or path.startswith('/Library/') )
|
||||
|
||||
@@ -224,6 +224,16 @@ def grep_headers_for(function, headers):
|
||||
return True
|
||||
return False
|
||||
|
||||
+def grep_headers_for(function, headers):
|
||||
+ for header in headers:
|
||||
|
@ -45,7 +43,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
def find_file(filename, std_dirs, paths):
|
||||
"""Searches for the directory where a given file is located,
|
||||
and returns a possibly-empty list of additional directories, or None
|
||||
@@ -740,15 +750,15 @@ class PyBuildExt(build_ext):
|
||||
@@ -725,15 +735,15 @@ class PyBuildExt(build_ext):
|
||||
add_dir_to_list(dir_list, directory)
|
||||
|
||||
def configure_compiler(self):
|
||||
|
@ -70,7 +68,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
self.add_multiarch_paths()
|
||||
self.add_ldflags_cppflags()
|
||||
|
||||
@@ -796,6 +806,9 @@ class PyBuildExt(build_ext):
|
||||
@@ -781,6 +791,9 @@ class PyBuildExt(build_ext):
|
||||
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
|
||||
|
||||
if MACOS:
|
||||
|
@ -80,7 +78,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
# This should work on any unixy platform ;-)
|
||||
# If the user has bothered specifying additional -I and -L flags
|
||||
# in OPT and LDFLAGS we might as well use them here.
|
||||
@@ -1013,8 +1026,6 @@ class PyBuildExt(build_ext):
|
||||
@@ -998,8 +1011,6 @@ class PyBuildExt(build_ext):
|
||||
# use the same library for the readline and curses modules.
|
||||
if 'curses' in readline_termcap_library:
|
||||
curses_library = readline_termcap_library
|
||||
|
@ -89,7 +87,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
# Issue 36210: OSS provided ncurses does not link on AIX
|
||||
# Use IBM supplied 'curses' for successful build of _curses
|
||||
elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
|
||||
@@ -1116,8 +1127,7 @@ class PyBuildExt(build_ext):
|
||||
@@ -1101,8 +1112,7 @@ class PyBuildExt(build_ext):
|
||||
# If the curses module is enabled, check for the panel module
|
||||
# _curses_panel needs some form of ncurses
|
||||
skip_curses_panel = True if AIX else False
|
||||
|
@ -99,7 +97,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
self.add(Extension('_curses_panel', ['_curses_panel.c'],
|
||||
include_dirs=curses_includes,
|
||||
define_macros=curses_defines,
|
||||
@@ -1368,6 +1378,31 @@ class PyBuildExt(build_ext):
|
||||
@@ -1353,6 +1363,31 @@ class PyBuildExt(build_ext):
|
||||
dbm_order = ['gdbm']
|
||||
# The standard Unix dbm module:
|
||||
if not CYGWIN:
|
||||
|
@ -131,7 +129,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
config_args = [arg.strip("'")
|
||||
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
|
||||
dbm_args = [arg for arg in config_args
|
||||
@@ -1379,7 +1414,7 @@ class PyBuildExt(build_ext):
|
||||
@@ -1364,7 +1399,7 @@ class PyBuildExt(build_ext):
|
||||
dbmext = None
|
||||
for cand in dbm_order:
|
||||
if cand == "ndbm":
|
||||
|
@ -140,7 +138,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
# Some systems have -lndbm, others have -lgdbm_compat,
|
||||
# others don't have either
|
||||
if self.compiler.find_library_file(self.lib_dirs,
|
||||
@@ -1779,6 +1814,8 @@ class PyBuildExt(build_ext):
|
||||
@@ -1764,6 +1799,8 @@ class PyBuildExt(build_ext):
|
||||
def detect_uuid(self):
|
||||
# Build the _uuid module if possible
|
||||
uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
|
||||
|
@ -149,133 +147,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
if uuid_incs is not None:
|
||||
if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
|
||||
uuid_libs = ['uuid']
|
||||
@@ -2101,43 +2138,17 @@ class PyBuildExt(build_ext):
|
||||
library_dirs=added_lib_dirs))
|
||||
return True
|
||||
|
||||
- def configure_ctypes_darwin(self, ext):
|
||||
- # Darwin (OS X) uses preconfigured files, in
|
||||
- # the Modules/_ctypes/libffi_osx directory.
|
||||
- ffi_srcdir = os.path.abspath(os.path.join(self.srcdir, 'Modules',
|
||||
- '_ctypes', 'libffi_osx'))
|
||||
- sources = [os.path.join(ffi_srcdir, p)
|
||||
- for p in ['ffi.c',
|
||||
- 'x86/darwin64.S',
|
||||
- 'x86/x86-darwin.S',
|
||||
- 'x86/x86-ffi_darwin.c',
|
||||
- 'x86/x86-ffi64.c',
|
||||
- 'powerpc/ppc-darwin.S',
|
||||
- 'powerpc/ppc-darwin_closure.S',
|
||||
- 'powerpc/ppc-ffi_darwin.c',
|
||||
- 'powerpc/ppc64-darwin_closure.S',
|
||||
- ]]
|
||||
-
|
||||
- # Add .S (preprocessed assembly) to C compiler source extensions.
|
||||
- self.compiler.src_extensions.append('.S')
|
||||
-
|
||||
- include_dirs = [os.path.join(ffi_srcdir, 'include'),
|
||||
- os.path.join(ffi_srcdir, 'powerpc')]
|
||||
- ext.include_dirs.extend(include_dirs)
|
||||
- ext.sources.extend(sources)
|
||||
- return True
|
||||
-
|
||||
def configure_ctypes(self, ext):
|
||||
- if not self.use_system_libffi:
|
||||
- if MACOS:
|
||||
- return self.configure_ctypes_darwin(ext)
|
||||
- print('INFO: Could not locate ffi libs and/or headers')
|
||||
- return False
|
||||
return True
|
||||
|
||||
def detect_ctypes(self):
|
||||
# Thomas Heller's _ctypes module
|
||||
- self.use_system_libffi = False
|
||||
+
|
||||
+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and MACOS):
|
||||
+ self.use_system_libffi = True
|
||||
+ else:
|
||||
+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
|
||||
+
|
||||
include_dirs = []
|
||||
extra_compile_args = ['-DPy_BUILD_CORE_MODULE']
|
||||
extra_link_args = []
|
||||
@@ -2150,11 +2161,9 @@ class PyBuildExt(build_ext):
|
||||
|
||||
if MACOS:
|
||||
sources.append('_ctypes/malloc_closure.c')
|
||||
- sources.append('_ctypes/darwin/dlfcn_simple.c')
|
||||
+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1')
|
||||
extra_compile_args.append('-DMACOSX')
|
||||
include_dirs.append('_ctypes/darwin')
|
||||
- # XXX Is this still needed?
|
||||
- # extra_link_args.extend(['-read_only_relocs', 'warning'])
|
||||
|
||||
elif HOST_PLATFORM == 'sunos5':
|
||||
# XXX This shouldn't be necessary; it appears that some
|
||||
@@ -2184,31 +2193,48 @@ class PyBuildExt(build_ext):
|
||||
sources=['_ctypes/_ctypes_test.c'],
|
||||
libraries=['m']))
|
||||
|
||||
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
|
||||
+ ffi_lib = None
|
||||
+
|
||||
ffi_inc_dirs = self.inc_dirs.copy()
|
||||
if MACOS:
|
||||
- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
|
||||
- return
|
||||
- # OS X 10.5 comes with libffi.dylib; the include files are
|
||||
- # in /usr/include/ffi
|
||||
- ffi_inc_dirs.append('/usr/include/ffi')
|
||||
-
|
||||
- ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
|
||||
- if not ffi_inc or ffi_inc[0] == '':
|
||||
- ffi_inc = find_file('ffi.h', [], ffi_inc_dirs)
|
||||
- if ffi_inc is not None:
|
||||
- ffi_h = ffi_inc[0] + '/ffi.h'
|
||||
+ ffi_in_sdk = os.path.join(macosx_sdk_root(), "usr/include/ffi")
|
||||
+
|
||||
+ if not ffi_inc:
|
||||
+ if os.path.exists(ffi_in_sdk):
|
||||
+ ext.extra_compile_args.append("-DUSING_APPLE_OS_LIBFFI=1")
|
||||
+ ffi_inc = ffi_in_sdk
|
||||
+ ffi_lib = 'ffi'
|
||||
+ else:
|
||||
+ # OS X 10.5 comes with libffi.dylib; the include files are
|
||||
+ # in /usr/include/ffi
|
||||
+ ffi_inc_dirs.append('/usr/include/ffi')
|
||||
+
|
||||
+ if not ffi_inc:
|
||||
+ found = find_file('ffi.h', [], ffi_inc_dirs)
|
||||
+ if found:
|
||||
+ ffi_inc = found[0]
|
||||
+ if ffi_inc:
|
||||
+ ffi_h = ffi_inc + '/ffi.h'
|
||||
if not os.path.exists(ffi_h):
|
||||
ffi_inc = None
|
||||
print('Header file {} does not exist'.format(ffi_h))
|
||||
- ffi_lib = None
|
||||
- if ffi_inc is not None:
|
||||
+ if ffi_lib is None and ffi_inc:
|
||||
for lib_name in ('ffi', 'ffi_pic'):
|
||||
if (self.compiler.find_library_file(self.lib_dirs, lib_name)):
|
||||
ffi_lib = lib_name
|
||||
break
|
||||
|
||||
if ffi_inc and ffi_lib:
|
||||
- ext.include_dirs.extend(ffi_inc)
|
||||
+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
|
||||
+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
|
||||
+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
|
||||
+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers):
|
||||
+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1")
|
||||
+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
|
||||
+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1")
|
||||
+
|
||||
+ ext.include_dirs.append(ffi_inc)
|
||||
ext.libraries.append(ffi_lib)
|
||||
self.use_system_libffi = True
|
||||
|
||||
@@ -2226,10 +2252,7 @@ class PyBuildExt(build_ext):
|
||||
@@ -2200,10 +2237,7 @@ class PyBuildExt(build_ext):
|
||||
sources = ['_decimal/_decimal.c']
|
||||
depends = ['_decimal/docstrings.h']
|
||||
else:
|
||||
|
@ -287,7 +159,7 @@ $NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
|
|||
libraries = ['m']
|
||||
sources = [
|
||||
'_decimal/_decimal.c',
|
||||
@@ -2609,7 +2632,7 @@ def main():
|
||||
@@ -2583,7 +2617,7 @@ def main():
|
||||
# If you change the scripts installed here, you also need to
|
||||
# check the PyBuildScripts command above, and change the links
|
||||
# created by the bininstall target in Makefile.pre.in
|
||||
|
|
Loading…
Reference in a new issue