pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/lang/python39 lang/python39: Fix for macOS 11 and Appl...
details: https://anonhg.NetBSD.org/pkgsrc/rev/be30a96bbd97
branches: trunk
changeset: 441871:be30a96bbd97
user: sjmulder <sjmulder%pkgsrc.org@localhost>
date: Thu Nov 12 10:58:20 2020 +0000
description:
lang/python39: Fix for macOS 11 and Apple Silicon
(Apple Silicon being their aarch64 platform.)
Patches consist of:
- Upstream work: https://github.com/python/cpython/pull/22855
- Fix for setup.py to find libbz2.tbd and libz.tbd now that with the
shared library cache there's nothing in /usr/lib.
See: https://bugs.python.org/issue41116
- Addition of __arch64__ case to fix _decimal module. A very similar fix
has since been committed upstream.
diffstat:
lang/python39/distinfo | 28 +-
lang/python39/patches/patch-Lib___osx__support.py | 81 +
lang/python39/patches/patch-Lib_ctypes_macholib_dyld.py | 35 +
lang/python39/patches/patch-Lib_ctypes_test_test__macholib.py | 36 +
lang/python39/patches/patch-Lib_distutils_tests_test__build__ext.py | 13 +
lang/python39/patches/patch-Lib_test_test__bytes.py | 15 +
lang/python39/patches/patch-Lib_test_test__platform.py | 16 +
lang/python39/patches/patch-Lib_test_test__unicode.py | 21 +
lang/python39/patches/patch-Mac_BuildScript_build-installer.py | 69 +
lang/python39/patches/patch-Mac_Tools_pythonw.c | 44 +
lang/python39/patches/patch-Modules___ctypes_callbacks.c | 76 +
lang/python39/patches/patch-Modules___ctypes_callproc.c | 190 +
lang/python39/patches/patch-Modules___ctypes_ctypes.h | 22 +
lang/python39/patches/patch-Modules___ctypes_malloc__closure.c | 37 +
lang/python39/patches/patch-Modules___decimal_libmpdec_mpdecimal.h | 16 +
lang/python39/patches/patch-Modules_getpath.c | 19 +
lang/python39/patches/patch-Modules_posixmodule.c | 1365 ++++++++++
lang/python39/patches/patch-Modules_timemodule.c | 322 ++
lang/python39/patches/patch-Python_bootstrap__hash.c | 73 +
lang/python39/patches/patch-Python_pytime.c | 73 +
lang/python39/patches/patch-configure | 117 +-
lang/python39/patches/patch-configure.ac | 82 +
lang/python39/patches/patch-pyconfig.h.in | 22 +-
lang/python39/patches/patch-setup.py | 164 +-
24 files changed, 2911 insertions(+), 25 deletions(-)
diffs (truncated from 3118 to 300 lines):
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/distinfo
--- a/lang/python39/distinfo Thu Nov 12 10:47:35 2020 +0000
+++ b/lang/python39/distinfo Thu Nov 12 10:58:20 2020 +0000
@@ -1,21 +1,41 @@
-$NetBSD: distinfo,v 1.1 2020/10/10 20:19:47 adam Exp $
+$NetBSD: distinfo,v 1.2 2020/11/12 10:58:20 sjmulder 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 (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_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) = fdb9594b1f738c38672bf247dd91da95d9160a3c
-SHA1 (patch-pyconfig.h.in) = 4bc6e95441cb5faae94d1d52aeaaa10ae01385b6
-SHA1 (patch-setup.py) = 5cd3600318a883a4308b0bb2d51e3feadf9f5ff5
+SHA1 (patch-configure) = 371a65a2cb10fe7709d30a16358b48bc2e0a4aa6
+SHA1 (patch-configure.ac) = 4ce75ef922e015adf095cb481c829b11c0454efe
+SHA1 (patch-pyconfig.h.in) = 7c1c997c089f882fbd334b81c04a03dbaebb2c41
+SHA1 (patch-setup.py) = a9e467f8aed7085a982af6a1273b883550d06610
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib___osx__support.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib___osx__support.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,81 @@
+$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'):
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_ctypes_macholib_dyld.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_ctypes_macholib_dyld.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,35 @@
+$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):
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_ctypes_test_test__macholib.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_ctypes_test_test__macholib.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,36 @@
+$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()
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_distutils_tests_test__build__ext.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_distutils_tests_test__build__ext.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,13 @@
+$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:
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_test_test__bytes.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_test_test__bytes.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,15 @@
+$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
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_test_test__platform.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_test_test__platform.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,16 @@
+$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')
+
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Lib_test_test__unicode.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_test_test__unicode.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,21 @@
+$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):
diff -r 9d2405ec929e -r be30a96bbd97 lang/python39/patches/patch-Mac_BuildScript_build-installer.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Mac_BuildScript_build-installer.py Thu Nov 12 10:58:20 2020 +0000
@@ -0,0 +1,69 @@
+$NetBSD: patch-Mac_BuildScript_build-installer.py,v 1.1 2020/11/12 10:58:21 sjmulder Exp $
+
Home |
Main Index |
Thread Index |
Old Index