pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/lang/python37 lang/python37: Fix for macOS 11 and Appl...
details: https://anonhg.NetBSD.org/pkgsrc/rev/a78da34b9875
branches: trunk
changeset: 442055:a78da34b9875
user: sjmulder <sjmulder%pkgsrc.org@localhost>
date: Tue Nov 17 19:33:26 2020 +0000
description:
lang/python37: Fix for macOS 11 and Apple Silicon
(Apple Silicon being their aarch64 platform.)
This is backport of the same in lang/python39 and lang/python38. Some
parts weren't applicable in 3.7. The setup.py script needed some work
on the ffi code. Otherwise, minor changes.
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/python37/Makefile | 4 +-
lang/python37/distinfo | 28 +-
lang/python37/patches/patch-Lib___osx__support.py | 80 +
lang/python37/patches/patch-Lib_ctypes_macholib_dyld.py | 35 +
lang/python37/patches/patch-Lib_ctypes_test_test__macholib.py | 36 +
lang/python37/patches/patch-Lib_test_test__bytes.py | 15 +
lang/python37/patches/patch-Lib_test_test__platform.py | 16 +
lang/python37/patches/patch-Lib_test_test__posix.py | 248 +
lang/python37/patches/patch-Lib_test_test__time.py | 44 +
lang/python37/patches/patch-Lib_test_test__unicode.py | 21 +
lang/python37/patches/patch-Mac_BuildScript_build-installer.py | 69 +
lang/python37/patches/patch-Mac_Tools_pythonw.c | 44 +
lang/python37/patches/patch-Modules___ctypes_callbacks.c | 76 +
lang/python37/patches/patch-Modules___ctypes_callproc.c | 181 +
lang/python37/patches/patch-Modules___ctypes_ctypes.h | 22 +
lang/python37/patches/patch-Modules___ctypes_malloc__closure.c | 37 +
lang/python37/patches/patch-Modules___decimal_libmpdec_mpdecimal.h | 17 +
lang/python37/patches/patch-Modules_posixmodule.c | 1357 ++++++++++
lang/python37/patches/patch-Modules_timemodule.c | 267 +
lang/python37/patches/patch-Python_bootstrap__hash.c | 73 +
lang/python37/patches/patch-Python_pytime.c | 73 +
lang/python37/patches/patch-configure | 122 +-
lang/python37/patches/patch-configure.ac | 64 +
lang/python37/patches/patch-pyconfig.h.in | 21 +-
lang/python37/patches/patch-setup.py | 179 +-
25 files changed, 3090 insertions(+), 39 deletions(-)
diffs (truncated from 3445 to 300 lines):
diff -r 4a7c17a45243 -r a78da34b9875 lang/python37/Makefile
--- a/lang/python37/Makefile Tue Nov 17 19:33:14 2020 +0000
+++ b/lang/python37/Makefile Tue Nov 17 19:33:26 2020 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.21 2020/09/01 09:26:54 schmonz Exp $
+# $NetBSD: Makefile,v 1.22 2020/11/17 19:33:26 sjmulder Exp $
.include "dist.mk"
PKGNAME= python37-${PY_DISTVERSION}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= lang python
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
diff -r 4a7c17a45243 -r a78da34b9875 lang/python37/distinfo
--- a/lang/python37/distinfo Tue Nov 17 19:33:14 2020 +0000
+++ b/lang/python37/distinfo Tue Nov 17 19:33:26 2020 +0000
@@ -1,22 +1,42 @@
-$NetBSD: distinfo,v 1.21 2020/09/01 09:26:54 schmonz Exp $
+$NetBSD: distinfo,v 1.22 2020/11/17 19:33:26 sjmulder Exp $
SHA1 (Python-3.7.9.tar.xz) = e1de02779a89a94000c0ed340ec126de25825f2f
RMD160 (Python-3.7.9.tar.xz) = 6ff3676f84b1a103b0e3161dcc7257936c914daf
SHA512 (Python-3.7.9.tar.xz) = e4217b25529b5336e43b63d17f3758a8177a58184564cf02bd92a312f58dba9e096485c9e3cb3544f966e847ea15b3ab30ed065d28a6ca52a6d7e0faddf7d9f9
Size (Python-3.7.9.tar.xz) = 17389636 bytes
+SHA1 (patch-Lib___osx__support.py) = dbec9925c1a0b6b845101df9825af52d83317773
SHA1 (patch-Lib_ctypes_____init____.py) = ded12eb372028288d85ba88b43e45549c6f48144
+SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 267f0b39f116bc9df0b24c277b48ce59cfecd397
+SHA1 (patch-Lib_ctypes_test_test__macholib.py) = 76bb73619e5a27aa1009d4c65e3be1f69b9b6e91
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_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69
SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2
SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c
+SHA1 (patch-Lib_test_test__bytes.py) = 9b97cd1cd753a0a7afdc601b606367655d4c47b1
+SHA1 (patch-Lib_test_test__platform.py) = b473d766ecdbba93cdcc66a4550c2d02bf37ae79
+SHA1 (patch-Lib_test_test__posix.py) = 3fcc7b483f1797d273b2337daeac514bd60a1e78
+SHA1 (patch-Lib_test_test__time.py) = e20c40aad6442422fae08ab937b9d128ad4b8fdc
+SHA1 (patch-Lib_test_test__unicode.py) = 4dfccf72ae60d1e1092ff84b7c05a735865ba8a8
+SHA1 (patch-Mac_BuildScript_build-installer.py) = a377ed164ee2ba72ce0f72ccf9507e775f7b7deb
+SHA1 (patch-Mac_Tools_pythonw.c) = 94f27032aac27263bc1c1bd66574121fbca1e380
SHA1 (patch-Makefile.pre.in) = 1393dac225c5a7edcb7947eb707b4526ea884f95
+SHA1 (patch-Modules___ctypes_callbacks.c) = 98bd449f9c4bf3acbcfdd24d017f490fc0c9326e
+SHA1 (patch-Modules___ctypes_callproc.c) = d0905ede69f2c61d917380d6da73c14e7e31d41f
+SHA1 (patch-Modules___ctypes_ctypes.h) = 2589d24c101771f8696b456d594e5f53305cf72c
+SHA1 (patch-Modules___ctypes_malloc__closure.c) = 780e7dfa293c57dc28e97358937ed7d148414c8e
+SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3840dc184f1f5faa590cdca57df911d5c71a9439
SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
+SHA1 (patch-Modules_posixmodule.c) = cae3797179c1a4d820dd294b69ca4b9a6fa81899
SHA1 (patch-Modules_socketmodule.c) = c0bdb256bccc176c2406feec4080cd91fcb693b2
SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
+SHA1 (patch-Modules_timemodule.c) = c0fa13e7f02046b1dfde36a50898b4c46ca3792e
+SHA1 (patch-Python_bootstrap__hash.c) = c60b3987e549987a1180edaab0ad2d48fc272925
+SHA1 (patch-Python_pytime.c) = 5d782457439708f5e8e46043eed5fe7ba40f45f9
SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = bb660a76f77d8cd544f6f8344a0a2b9c62953e00
-SHA1 (patch-pyconfig.h.in) = 58e2c03489f9b6e4d88f144d8c09773f92eacd61
-SHA1 (patch-setup.py) = 3edd2ab894f453be19dc4af06f3e78f49e5e2c34
+SHA1 (patch-configure) = 2c7d3fb29c2fc9a7a75adbddf7399f5e69baeaca
+SHA1 (patch-configure.ac) = 948e925ef2595058a902ad60762158f16d13db80
+SHA1 (patch-pyconfig.h.in) = 1a837a44c9b4f6e538909dba70482082e5a6b80f
+SHA1 (patch-setup.py) = d42d76b6edc5b5b7855b2888e0df7ab723ade6a5
diff -r 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib___osx__support.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib___osx__support.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,80 @@
+$NetBSD: patch-Lib___osx__support.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/_osx_support.py.orig 2020-08-15 05:20:16.000000000 +0000
++++ Lib/_osx_support.py
+@@ -110,6 +110,25 @@ 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 +151,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 +354,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 +510,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 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib_ctypes_macholib_dyld.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib_ctypes_macholib_dyld.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,35 @@
+$NetBSD: patch-Lib_ctypes_macholib_dyld.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/ctypes/macholib/dyld.py.orig 2020-08-15 05:20:16.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 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib_ctypes_test_test__macholib.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib_ctypes_test_test__macholib.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-Lib_ctypes_test_test__macholib.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/ctypes/test/test_macholib.py.orig 2020-08-15 05:20:16.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 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib_test_test__bytes.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib_test_test__bytes.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-Lib_test_test__bytes.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/test/test_bytes.py.orig 2020-08-15 05:20:16.000000000 +0000
++++ Lib/test/test_bytes.py
+@@ -903,6 +903,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 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib_test_test__platform.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib_test_test__platform.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-Lib_test_test__platform.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/test/test_platform.py.orig 2020-08-15 05:20:16.000000000 +0000
++++ Lib/test/test_platform.py
+@@ -254,7 +254,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 4a7c17a45243 -r a78da34b9875 lang/python37/patches/patch-Lib_test_test__posix.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python37/patches/patch-Lib_test_test__posix.py Tue Nov 17 19:33:26 2020 +0000
@@ -0,0 +1,248 @@
+$NetBSD: patch-Lib_test_test__posix.py,v 1.1 2020/11/17 19:33:26 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/test/test_posix.py.orig 2020-08-15 05:20:16.000000000 +0000
++++ Lib/test/test_posix.py
+@@ -1502,9 +1502,239 @@ class PosixGroupsTester(unittest.TestCas
+ posix.setgroups(groups)
+ self.assertListEqual(groups, posix.getgroups())
+
++@unittest.skipUnless(sys.platform == "darwin", "test weak linking on macOS")
++class TestPosixWeaklinking(unittest.TestCase):
++ # These test cases verify that weak linking support on macOS works
++ # as expected. These cases only test new behaviour introduced by weak linking,
++ # regular behaviour is tested by the normal test cases.
++ #
++ # See the section on Weak Linking in Mac/README.txt for more information.
++ def setUp(self):
++ import sysconfig
++ import platform
++
++ config_vars = sysconfig.get_config_vars()
++ self.available = { nm for nm in config_vars if nm.startswith("HAVE_") and config_vars[nm] }
++ self.mac_ver = tuple(int(part) for part in platform.mac_ver()[0].split("."))
++
++ def _verify_available(self, name):
++ if name not in self.available:
++ raise unittest.SkipTest(f"{name} not weak-linked")
Home |
Main Index |
Thread Index |
Old Index