pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python38 lang/python38: Fix for macOS 11 and Appl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4a7c17a45243
branches:  trunk
changeset: 442054:4a7c17a45243
user:      sjmulder <sjmulder%pkgsrc.org@localhost>
date:      Tue Nov 17 19:33:14 2020 +0000

description:
lang/python38: Fix for macOS 11 and Apple Silicon

(Apple Silicon being their aarch64 platform.)

This is backport of the same in lang/python39. Only minor changes were
needed.

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/python38/Makefile                                              |     3 +-
 lang/python38/distinfo                                              |    28 +-
 lang/python38/patches/patch-Lib___osx__support.py                   |    80 +
 lang/python38/patches/patch-Lib_ctypes_macholib_dyld.py             |    35 +
 lang/python38/patches/patch-Lib_ctypes_test_test__macholib.py       |    36 +
 lang/python38/patches/patch-Lib_distutils_tests_test__build__ext.py |    16 +
 lang/python38/patches/patch-Lib_test_test__bytes.py                 |    15 +
 lang/python38/patches/patch-Lib_test_test__platform.py              |    16 +
 lang/python38/patches/patch-Lib_test_test__unicode.py               |    21 +
 lang/python38/patches/patch-Mac_BuildScript_build-installer.py      |    68 +
 lang/python38/patches/patch-Mac_Tools_pythonw.c                     |    44 +
 lang/python38/patches/patch-Modules___ctypes_callbacks.c            |    76 +
 lang/python38/patches/patch-Modules___ctypes_callproc.c             |   190 +
 lang/python38/patches/patch-Modules___ctypes_ctypes.h               |    22 +
 lang/python38/patches/patch-Modules___ctypes_malloc__closure.c      |    37 +
 lang/python38/patches/patch-Modules___decimal_libmpdec_mpdecimal.h  |    17 +
 lang/python38/patches/patch-Modules_getpath.c                       |    19 +
 lang/python38/patches/patch-Modules_posixmodule.c                   |  1373 ++++++++++
 lang/python38/patches/patch-Modules_timemodule.c                    |   271 +
 lang/python38/patches/patch-Python_bootstrap__hash.c                |    73 +
 lang/python38/patches/patch-Python_pytime.c                         |    73 +
 lang/python38/patches/patch-configure                               |   104 +-
 lang/python38/patches/patch-configure.ac                            |    64 +
 lang/python38/patches/patch-pyconfig.h.in                           |    22 +-
 lang/python38/patches/patch-setup.py                                |   182 +-
 25 files changed, 2848 insertions(+), 37 deletions(-)

diffs (truncated from 3112 to 300 lines):

diff -r 032b7efaf05c -r 4a7c17a45243 lang/python38/Makefile
--- a/lang/python38/Makefile    Tue Nov 17 18:03:00 2020 +0000
+++ b/lang/python38/Makefile    Tue Nov 17 19:33:14 2020 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.13 2020/08/14 19:28:44 schmonz Exp $
+# $NetBSD: Makefile,v 1.14 2020/11/17 19:33:14 sjmulder Exp $
 
 .include "dist.mk"
 
 PKGNAME=       python38-${PY_DISTVERSION}
+PKGREVISION=   1
 CATEGORIES=    lang python
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
diff -r 032b7efaf05c -r 4a7c17a45243 lang/python38/distinfo
--- a/lang/python38/distinfo    Tue Nov 17 18:03:00 2020 +0000
+++ b/lang/python38/distinfo    Tue Nov 17 19:33:14 2020 +0000
@@ -1,21 +1,41 @@
-$NetBSD: distinfo,v 1.12 2020/09/28 19:31:55 adam Exp $
+$NetBSD: distinfo,v 1.13 2020/11/17 19:33:14 sjmulder Exp $
 
 SHA1 (Python-3.8.6.tar.xz) = 6ee446eaacf901a3305565bd6569e2de135168e3
 RMD160 (Python-3.8.6.tar.xz) = 89c134d2d1bc02975cf959cc4a7ee63dba5c5388
 SHA512 (Python-3.8.6.tar.xz) = 22faec84f6e172e1ac7c6bd6fd37e9b6ae4afc91cf5136aa8cac8ebbed8d18793f9196e8749b8ccc43447cb6c41cb450f65ea72dd363c06dfaeb14e0455f5560
 Size (Python-3.8.6.tar.xz) = 18233864 bytes
+SHA1 (patch-Lib___osx__support.py) = 95c729132e5bdbda72789f02b37ed111d0d9d11e
+SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 3acfa836e06bb1ca994357bc4b687af1ce1641e0
+SHA1 (patch-Lib_ctypes_test_test__macholib.py) = db352894c47cbb4bed4905b4a7dde272577c65d8
 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) = 481dce36ddb258707470d18f84c300700326dc1e
 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) = 6de71f3d00cc2079f1c2fcf1a56eca993a4dc43a
+SHA1 (patch-Lib_test_test__platform.py) = ce6825dba49024fcd200638614209b31ae24df0a
+SHA1 (patch-Lib_test_test__unicode.py) = 915a80e2c7b9e056e58fc8600b099e86634f28dd
+SHA1 (patch-Mac_BuildScript_build-installer.py) = 731aa225a7cf33a21431bbd34d50cb5f629ab0df
+SHA1 (patch-Mac_Tools_pythonw.c) = aa2e7bfc5c515d48916f817d04fe2bb9775ea3c3
 SHA1 (patch-Makefile.pre.in) = d42f9f5bca1dd663f64122dc95b49111452fe6e8
+SHA1 (patch-Modules___ctypes_callbacks.c) = 99d821b1db08e680bc8ed3faecbda07f31e389e0
+SHA1 (patch-Modules___ctypes_callproc.c) = ec013388ecf599d3faad20a3945e852bed94a5e7
+SHA1 (patch-Modules___ctypes_ctypes.h) = bfa5574db6be78f71584e6b0b92965804cb469ba
+SHA1 (patch-Modules___ctypes_malloc__closure.c) = eadb811e15c4b821790480d7c4a4908753773e0f
+SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3710f2e524a8786470d01e7b2fc812600f0ec169
+SHA1 (patch-Modules_getpath.c) = c6930e41e57e31e3f46b4b9e0d0f5fcc8a0e5163
 SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
 SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
+SHA1 (patch-Modules_posixmodule.c) = ea24a1aa19b596b5d4457a4eff761e516406145f
 SHA1 (patch-Modules_socketmodule.c) = e99fd9e30e3feafef1747a2f52446d8fec543362
 SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
+SHA1 (patch-Modules_timemodule.c) = bc8ba8c63e6be1411067480d661bd3b23dfa14c0
+SHA1 (patch-Python_bootstrap__hash.c) = 2e7d24ded1369624b2983b15784988517a9697a5
+SHA1 (patch-Python_pytime.c) = 41981f821e0b420abcb0334312148deb9a9fed5e
 SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = 11991489b71557cc934e268981703e9b1dbba4c6
-SHA1 (patch-pyconfig.h.in) = 4bc6e95441cb5faae94d1d52aeaaa10ae01385b6
-SHA1 (patch-setup.py) = ee2adad91434f2739a266c8b5eaad07767b9571a
+SHA1 (patch-configure) = c63ae7364c69fed98d366fd2b6a727a71b10defc
+SHA1 (patch-configure.ac) = 2b341061350671d820d696a659176a35a93d800d
+SHA1 (patch-pyconfig.h.in) = 6e24f401286768641c7d69dd75cfe18f1d8df1e7
+SHA1 (patch-setup.py) = 2211bfe01c6c53f5c9852f9569a31975f7b7cb5e
diff -r 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib___osx__support.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib___osx__support.py Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,80 @@
+$NetBSD: patch-Lib___osx__support.py,v 1.1 2020/11/17 19:33:15 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-09-23 12:36:32.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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_ctypes_macholib_dyld.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_ctypes_macholib_dyld.py   Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,35 @@
+$NetBSD: patch-Lib_ctypes_macholib_dyld.py,v 1.1 2020/11/17 19:33:15 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-09-23 12:36:32.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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_ctypes_test_test__macholib.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_ctypes_test_test__macholib.py     Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-Lib_ctypes_test_test__macholib.py,v 1.1 2020/11/17 19:33:15 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-09-23 12:36:32.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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_distutils_tests_test__build__ext.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_distutils_tests_test__build__ext.py       Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-Lib_distutils_tests_test__build__ext.py,v 1.1 2020/11/17 19:33:15 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/distutils/tests/test_build_ext.py.orig 2020-09-23 12:36:32.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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_test_test__bytes.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_test_test__bytes.py       Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-Lib_test_test__bytes.py,v 1.1 2020/11/17 19:33:15 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-09-23 12:36:32.000000000 +0000
++++ Lib/test/test_bytes.py
+@@ -963,6 +963,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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_test_test__platform.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_test_test__platform.py    Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-Lib_test_test__platform.py,v 1.1 2020/11/17 19:33:15 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-09-23 12:36:32.000000000 +0000
++++ Lib/test/test_platform.py
+@@ -217,7 +217,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 032b7efaf05c -r 4a7c17a45243 lang/python38/patches/patch-Lib_test_test__unicode.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python38/patches/patch-Lib_test_test__unicode.py     Tue Nov 17 19:33:14 2020 +0000
@@ -0,0 +1,21 @@
+$NetBSD: patch-Lib_test_test__unicode.py,v 1.1 2020/11/17 19:33:15 sjmulder Exp $
+
+Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
+https://github.com/python/cpython/pull/22855
+
+--- Lib/test/test_unicode.py.orig      2020-09-23 12:36:32.000000000 +0000
++++ Lib/test/test_unicode.py
+@@ -2454,11 +2454,13 @@ class CAPITest(unittest.TestCase):
+     def test_from_format(self):
+         support.import_module('ctypes')
+         from ctypes import (



Home | Main Index | Thread Index | Old Index