pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/python27 Fix build on darwin20 and macOS arm64, v...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0c1cc565ae02
branches:  trunk
changeset: 454859:0c1cc565ae02
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Wed Jun 23 18:30:24 2021 +0000

description:
Fix build on darwin20 and macOS arm64, via MacPorts. For other
platforms, NFCI.

diffstat:

 lang/python27/distinfo                                              |   23 +-
 lang/python27/patches/patch-Lib___osx__support.py                   |   26 ++
 lang/python27/patches/patch-Lib_ctypes_macholib_dyld.py             |   32 ++
 lang/python27/patches/patch-Lib_ctypes_test_test__macholib.py       |   34 ++
 lang/python27/patches/patch-Lib_distutils_tests_test__build__ext.py |   15 +
 lang/python27/patches/patch-Lib_test_test__platform.py              |   27 ++
 lang/python27/patches/patch-Lib_test_test__unicode.py               |   22 +
 lang/python27/patches/patch-Lib_test_test__urllib2.py               |   44 +-
 lang/python27/patches/patch-Mac_Tools_pythonw.c                     |   16 +
 lang/python27/patches/patch-Modules___ctypes_callbacks.c            |   43 +++
 lang/python27/patches/patch-Modules___ctypes_callproc.c             |  119 ++++++++++
 lang/python27/patches/patch-Modules___ctypes_ctypes.h               |   20 +
 lang/python27/patches/patch-Modules___ctypes_malloc__closure.c      |   39 +++
 lang/python27/patches/patch-Modules_getpath.c                       |   14 +-
 lang/python27/patches/patch-configure                               |   54 +++-
 lang/python27/patches/patch-pyconfig.h.in                           |   17 +-
 lang/python27/patches/patch-setup.py                                |   65 ++++-
 17 files changed, 553 insertions(+), 57 deletions(-)

diffs (truncated from 919 to 300 lines):

diff -r de39c382811e -r 0c1cc565ae02 lang/python27/distinfo
--- a/lang/python27/distinfo    Wed Jun 23 18:20:23 2021 +0000
+++ b/lang/python27/distinfo    Wed Jun 23 18:30:24 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.81 2020/09/27 14:57:22 leot Exp $
+$NetBSD: distinfo,v 1.82 2021/06/23 18:30:24 schmonz Exp $
 
 SHA1 (Python-2.7.18.tar.xz) = 678d4cf483a1c92efd347ee8e1e79326dc82810b
 RMD160 (Python-2.7.18.tar.xz) = 40a514bb05c9e631454ea8466e28f5bb229428ad
@@ -6,11 +6,15 @@
 Size (Python-2.7.18.tar.xz) = 12854736 bytes
 SHA1 (patch-Include_pyerrors.h) = 0d2cd52d18cc719b895fa32ed7e11c6cb15bae54
 SHA1 (patch-Include_pyport.h) = f3e4ddbc954425a65301465410911222ca471320
+SHA1 (patch-Lib___osx__support.py) = 4389472565616b3875c699f6e3e74850d5fde712
 SHA1 (patch-Lib_ctypes_____init____.py) = 31dd0546bbe29ad1b1d481edc525ba43479c06da
+SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 9b7e972d4c71311742ca8b3501382182a4c9e2fe
+SHA1 (patch-Lib_ctypes_test_test__macholib.py) = 4479d315cd037f4c9138e8f5baa8eb1685932baa
 SHA1 (patch-Lib_ctypes_util.py) = 6fa516c7b43f08992427a0afcbe80c17bcc070f1
 SHA1 (patch-Lib_distutils_command_build__ext.py) = ea4feba4e93dbcff07050c82a00d591bb650e934
 SHA1 (patch-Lib_distutils_command_install.py) = e6aef090b444b455fe351308d251e670329b7dc3
 SHA1 (patch-Lib_distutils_command_install__egg__info.py) = ec7f9e0cd04489b1f6497c44d75bff6864ad1047
+SHA1 (patch-Lib_distutils_tests_test__build__ext.py) = 6b3c8c8d1d351836b239c049d34d132953bd4786
 SHA1 (patch-Lib_distutils_unixccompiler.py) = db16c9aca2f29730945f28247b88b18828739bbb
 SHA1 (patch-Lib_distutils_util.py) = 5bcfad96f8e490351160f1a7c1f4ece7706a33fa
 SHA1 (patch-Lib_httplib.py) = 375d80eb79209f53046c62db128d8d3f64d9e765
@@ -20,14 +24,21 @@
 SHA1 (patch-Lib_sysconfig.py) = 8a7a0e5cbfec279a05945dffafea1b1131a76f0e
 SHA1 (patch-Lib_tarfile.py) = df00aa1941367c42dcbbed4b6658b724a22ddcde
 SHA1 (patch-Lib_test_test__httplib.py) = 9d37263e36110838e0b5f413ff4747deb3966dfe
-SHA1 (patch-Lib_test_test__urllib2.py) = 09013a0b4a3e6064cbfe96572e47464c5d6ef047
+SHA1 (patch-Lib_test_test__platform.py) = 3a3b8c05f9bf9adf4862b1022ce864127d36b8b0
+SHA1 (patch-Lib_test_test__unicode.py) = 1bd182bdbd880d0a847f9d8b69277a607f9f0526
+SHA1 (patch-Lib_test_test__urllib2.py) = 89baa57daf2f3282e4fc5009915dbc4910b96ef1
 SHA1 (patch-Lib_urllib2.py) = 33a85593da702447fa3ea74b4e3d36d0016f70b5
+SHA1 (patch-Mac_Tools_pythonw.c) = 2b9a60d4b349c240471fd305be69c28e0f654cdc
 SHA1 (patch-Makefile.pre.in) = ceaf34237588b527478ce1f9163c9168382fa201
+SHA1 (patch-Modules___ctypes_callbacks.c) = 8c335edfc9d2ef47988c5bdf1c3dd8473757637b
+SHA1 (patch-Modules___ctypes_callproc.c) = adac5eb047eb58c14003ea9237d5d34e8b327b2f
+SHA1 (patch-Modules___ctypes_ctypes.h) = 07e9d5ecf8309a3ca4bf8382411d56dda08d7b27
+SHA1 (patch-Modules___ctypes_malloc__closure.c) = 25d470cc66d218446227c7c1bd7ade409c53b8d0
 SHA1 (patch-Modules___multiprocessing_multiprocessing.h) = 7ca8fe22ba4bdcde6d39dd50fe2e86c25994c146
 SHA1 (patch-Modules___multiprocessing_semaphore.c) = 03b9c33ef38da383d5f7c2c84c17fe38cdd2911e
 SHA1 (patch-Modules__ssl.c) = 6e68f88ad205106691900f091a897ffe0a4c363c
 SHA1 (patch-Modules_getaddrinfo.c) = aa699d257f1bc98b9a3183a21324053e134409d1
-SHA1 (patch-Modules_getpath.c) = 9bb2c040895ad6bbe4d0b5807803723b5437d47b
+SHA1 (patch-Modules_getpath.c) = 4e6445be9da49626800c03eaaab28fb3826be9f9
 SHA1 (patch-Modules_makesetup) = 9aad78714c4fe1a21cf66a6627d97d164ecea196
 SHA1 (patch-Modules_nismodule.c) = 129ef7b32779944c2f1827c6b078a3aafab60729
 SHA1 (patch-Modules_posixmodule.c) = 5105d380cd49bf49b8adbd9aa5ffb245195728ed
@@ -35,6 +46,6 @@
 SHA1 (patch-Modules_socketmodule.c) = 16848d90947b3de1f921a0813fa5c317f76961d4
 SHA1 (patch-Modules_sunaudiodev.c) = d836d77854a2b3d79fa34a06a8e2493bf0a503e6
 SHA1 (patch-Python_thread__pthread.h) = 517cfefc2f2e13631d22bad28c327513cdf17c10
-SHA1 (patch-configure) = 999700e96dd227cdd16cea3ae1001eb887ab8fee
-SHA1 (patch-pyconfig.h.in) = a0143ecdc2a3fb10220d0e3ee94fb9779a45e9e1
-SHA1 (patch-setup.py) = bf9763d5a3584970474d5951ed1fc73eb03ea11c
+SHA1 (patch-configure) = a8bcacd360ca3a451c43a05a4be3bcea56f70617
+SHA1 (patch-pyconfig.h.in) = 66d1a685e17ef7977bf09cdc64bdf80087216bc7
+SHA1 (patch-setup.py) = 19aa0992ea75cd151be7e35f05d9af0a84d07e85
diff -r de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib___osx__support.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib___osx__support.py Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-Lib___osx__support.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+macOS arm64 support, via MacPorts.
+
+--- Lib/_osx_support.py.orig   2021-06-22 19:20:03.000000000 +0000
++++ Lib/_osx_support.py
+@@ -470,6 +470,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'):
+@@ -484,6 +486,10 @@ def get_platform_osx(_config_vars, osnam
+                 raise ValueError(
+                    "Don't know machine value for archs=%r" % (archs,))
+ 
++        elif machine == 'arm':
++            # No 32-bit arm support on macOS
++            machine = 'arm64'
++
+         elif machine == 'i386':
+             # On OSX the machine type returned by uname is always the
+             # 32-bit variant, even if the executable architecture is
diff -r de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_ctypes_macholib_dyld.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib_ctypes_macholib_dyld.py   Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,32 @@
+$NetBSD: patch-Lib_ctypes_macholib_dyld.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+darwin20 support, via MacPorts.
+
+--- Lib/ctypes/macholib/dyld.py.orig   2021-06-22 19:20:28.000000000 +0000
++++ Lib/ctypes/macholib/dyld.py
+@@ -7,6 +7,12 @@ from framework import framework_info
+ from 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',
+     'framework_info', 'dylib_info',
+@@ -132,6 +138,12 @@ def dyld_find(name, executable_path=None
+             ), 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 de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_ctypes_test_test__macholib.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib_ctypes_test_test__macholib.py     Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,34 @@
+$NetBSD: patch-Lib_ctypes_test_test__macholib.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+darwin20 support, via MacPorts.
+
+--- Lib/ctypes/test/test_macholib.py.orig      2021-06-22 19:20:28.000000000 +0000
++++ Lib/ctypes/test/test_macholib.py
+@@ -48,18 +48,22 @@ 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 macOS 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.assertRegexpMatches(result, r".*/lib/libz\..*.*\.dylib")
++        self.assertRegexpMatches(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 de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_distutils_tests_test__build__ext.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib_distutils_tests_test__build__ext.py       Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-Lib_distutils_tests_test__build__ext.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+darwin20 support, via MacPorts.
+
+--- Lib/distutils/tests/test_build_ext.py.orig 2021-06-22 19:20:28.000000000 +0000
++++ Lib/distutils/tests/test_build_ext.py
+@@ -491,7 +491,7 @@ class BuildExtTestCase(support.TempdirMa
+         # 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 de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_test_test__platform.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib_test_test__platform.py    Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,27 @@
+$NetBSD: patch-Lib_test_test__platform.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+darwin20 support, via MacPorts.
+
+--- Lib/test/test_platform.py.orig     2021-06-22 19:20:28.000000000 +0000
++++ Lib/test/test_platform.py
+@@ -207,6 +207,11 @@ class PlatformTest(unittest.TestCase):
+             fd.close()
+             self.assertFalse(real_ver is None)
+             result_list = res[0].split('.')
++            # macOS 11.0 (Big Sur) may report its version number
++            # as 10.16 if the executable is built with an older
++            # SDK target but sw_vers reports 11.0.
++            if result_list == ['10', '16']:
++                result_list = ['11', '0']
+             expect_list = real_ver.split('.')
+             len_diff = len(result_list) - len(expect_list)
+             # On Snow Leopard, sw_vers reports 10.6.0 as 10.6
+@@ -220,7 +225,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 de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_test_test__unicode.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python27/patches/patch-Lib_test_test__unicode.py     Wed Jun 23 18:30:24 2021 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-Lib_test_test__unicode.py,v 1.1 2021/06/23 18:30:24 schmonz Exp $
+
+macOS arm64 support, via MacPorts.
+
+--- Lib/test/test_unicode.py.orig      2021-06-22 19:20:03.000000000 +0000
++++ Lib/test/test_unicode.py
+@@ -1676,6 +1676,7 @@ class CAPITest(unittest.TestCase):
+     def test_from_format(self):
+         test_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)
+@@ -1684,6 +1685,7 @@ class CAPITest(unittest.TestCase):
+         else:
+             name = "PyUnicodeUCS4_FromFormat"
+         _PyUnicode_FromFormat = getattr(pythonapi, name)
++        _PyUnicode_FromFormat.argtypes = (c_char_p,)
+         _PyUnicode_FromFormat.restype = py_object
+ 
+         def PyUnicode_FromFormat(format, *args):
diff -r de39c382811e -r 0c1cc565ae02 lang/python27/patches/patch-Lib_test_test__urllib2.py
--- a/lang/python27/patches/patch-Lib_test_test__urllib2.py     Wed Jun 23 18:20:23 2021 +0000
+++ b/lang/python27/patches/patch-Lib_test_test__urllib2.py     Wed Jun 23 18:30:24 2021 +0000
@@ -1,11 +1,11 @@
-$NetBSD: patch-Lib_test_test__urllib2.py,v 1.2 2020/09/20 12:10:27 mgorny Exp $
+$NetBSD: patch-Lib_test_test__urllib2.py,v 1.3 2021/06/23 18:30:24 schmonz Exp $
 
 bpo-39503 (CVE-2020-8492): ReDoS on AbstractBasicAuthHandler
 
 taken from:
 https://gitweb.gentoo.org/fork/cpython.git/commit/?h=gentoo-2.7-vanilla&id=2273e65e11dd0234f2f51ebaef61fc6e848d4059
 
---- Lib/test/test_urllib2.py.orig      2020-04-19 21:13:39.000000000 +0000
+--- Lib/test/test_urllib2.py.orig      2021-06-22 19:20:43.000000000 +0000
 +++ Lib/test/test_urllib2.py
 @@ -1128,42 +1128,67 @@ class HandlerTests(unittest.TestCase):
          self.assertEqual(req.get_host(), "proxy.example.com:3128")
@@ -29,26 +29,10 @@
                                "http://acme.example.com/protected";,
 -                              "http://acme.example.com/protected";
 -                             )
-+                              "http://acme.example.com/protected";)
- 
+-
 -    def test_basic_auth_with_single_quoted_realm(self):
 -        self.test_basic_auth(quote_char="'")
-+    def test_basic_auth(self):
-+        realm = "realm2%example.com@localhost"
-+        realm2 = "realm2%example.com@localhost"
-+        basic = 'Basic realm="{realm}"'.format(realm=realm)
-+        basic2 = 'Basic realm="{realm2}"'.format(realm2=realm2)
-+        other_no_realm = 'Otherscheme xxx'
-+        digest = ('Digest realm="{realm2}", '
-+                  'qop="auth, auth-int", '
-+                  'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", '
-+                  'opaque="5ccc069c403ebaf9f0171e9517f40e41"'
-+                  .format(realm2=realm2))
-+        for realm_str in (
-+            # test "quote" and 'quote'
-+            'Basic realm="{realm}"'.format(realm=realm),
-+            "Basic realm='{realm}'".format(realm=realm),
- 
+-
 -    def test_basic_auth_with_unquoted_realm(self):
 -        opener = OpenerDirector()
 -        password_manager = MockPasswordManager()
@@ -65,6 +49,24 @@
 -                                  "http://acme.example.com/protected";,
 -                                  "http://acme.example.com/protected";
 -                                 )
++                              "http://acme.example.com/protected";)
+ 
++    def test_basic_auth(self):
++        realm = "realm2%example.com@localhost"
++        realm2 = "realm2%example.com@localhost"
++        basic = 'Basic realm="{realm}"'.format(realm=realm)
++        basic2 = 'Basic realm="{realm2}"'.format(realm2=realm2)
++        other_no_realm = 'Otherscheme xxx'
++        digest = ('Digest realm="{realm2}", '
++                  'qop="auth, auth-int", '
++                  'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", '



Home | Main Index | Thread Index | Old Index