python39, python310: Fixes for Mac OS X 10.4 via MacPorts.

This commit is contained in:
nia 2023-11-10 09:48:39 +00:00
parent 40e7ea06e7
commit d5c403ed5a
10 changed files with 260 additions and 10 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.26 2023/10/23 06:36:00 wiz Exp $
$NetBSD: distinfo,v 1.27 2023/11/10 09:48:40 nia Exp $
BLAKE2s (Python-3.10.13.tar.xz) = c714daeb2437980ce940e76db70f037d844bcddc06dddb6ac966cef281a2b514
SHA512 (Python-3.10.13.tar.xz) = 7579772e501486b2b07f78142082dee1e99c7643640098860ac0cf2ca87daf7588b0c00b1db1960146b37f56a6ed98fd08297c25c9a19b612cf6e6a258984da8
@ -7,10 +7,13 @@ SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764
SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf
SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390
SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f
SHA1 (patch-Lib_test_test__shutil.py) = 2eb724d490544e77610a19a07dc0f9336dba3e2f
SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a
SHA1 (patch-Modules_clinic_posixmodule.c.h) = 3729243da6b4df47a956db9b784b056189c6403e
SHA1 (patch-Modules_posixmodule.c) = 1a1b866c9190fda8ca9c547085614b0f1d5469e1
SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b
SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c
SHA1 (patch-Python_thread__pthread.h) = bf1aeab011b3afedc02e68fcf5cef091b3e0aefa
SHA1 (patch-Python_thread__pthread.h) = b8efa178380fe48da4a0bf2bfa906851a314824e
SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6
SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6
SHA1 (patch-setup.py) = 5ab776a53ad361fdea9004817a7157743ab42db7

View file

@ -0,0 +1,25 @@
$NetBSD: patch-Lib_test_test__shutil.py,v 1.1 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Lib/test/test_shutil.py.orig 2023-08-24 12:46:25.000000000 +0000
+++ Lib/test/test_shutil.py
@@ -2601,7 +2601,7 @@ class TestZeroCopySendfile(_ZeroCopyFile
shutil._USE_CP_SENDFILE = True
-@unittest.skipIf(not MACOS, 'macOS only')
+@unittest.skipIf(not MACOS or not hasattr(posix, "_fcopyfile"), 'macOS with posix._fcopyfile only')
class TestZeroCopyMACOS(_ZeroCopyFileTest, unittest.TestCase):
PATCHPOINT = "posix._fcopyfile"

View file

@ -0,0 +1,25 @@
$NetBSD: patch-Modules_clinic_posixmodule.c.h,v 1.1 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Modules/clinic/posixmodule.c.h.orig 2023-08-24 12:46:25.000000000 +0000
+++ Modules/clinic/posixmodule.c.h
@@ -5270,7 +5270,7 @@ exit:
#endif /* defined(HAVE_SENDFILE) && !defined(__APPLE__) && !(defined(__FreeBSD__) || defined(__DragonFly__)) */
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
PyDoc_STRVAR(os__fcopyfile__doc__,
"_fcopyfile($module, in_fd, out_fd, flags, /)\n"

View file

@ -0,0 +1,52 @@
$NetBSD: patch-Modules_posixmodule.c,v 1.1 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Modules/posixmodule.c.orig 2023-08-24 12:46:25.000000000 +0000
+++ Modules/posixmodule.c
@@ -66,6 +66,8 @@
*/
#if defined(__APPLE__)
+#include <AvailabilityMacros.h>
+
#if defined(__has_builtin)
#if __has_builtin(__builtin_available)
#define HAVE_BUILTIN_AVAILABLE 1
@@ -238,7 +240,7 @@ corresponding Unix manual entries for mo
# include <sys/sendfile.h>
#endif
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
# include <copyfile.h>
#endif
@@ -9997,7 +9999,7 @@ done:
#endif /* HAVE_SENDFILE */
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
/*[clinic input]
os._fcopyfile
@@ -15440,7 +15442,7 @@ all_ins(PyObject *m)
#endif
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;
#endif

View file

@ -1,10 +1,11 @@
$NetBSD: patch-Python_thread__pthread.h,v 1.2 2021/12/11 10:40:58 wiz Exp $
$NetBSD: patch-Python_thread__pthread.h,v 1.3 2023/11/10 09:48:40 nia Exp $
https://bugs.python.org/issue46045
https://trac.macports.org/ticket/59772
--- Python/thread_pthread.h.orig 2013-05-15 16:33:00.000000000 +0000
--- Python/thread_pthread.h.orig 2023-08-24 12:46:25.000000000 +0000
+++ Python/thread_pthread.h
@@ -82,6 +82,9 @@
@@ -81,6 +81,9 @@
we need to add 0 to make it work there as well. */
#if (_POSIX_SEMAPHORES+0) == -1
#define HAVE_BROKEN_POSIX_SEMAPHORES
@ -14,3 +15,21 @@ https://bugs.python.org/issue46045
#else
#include <semaphore.h>
#include <errno.h>
@@ -343,7 +346,17 @@ PyThread_get_thread_native_id(void)
PyThread_init_thread();
#ifdef __APPLE__
uint64_t native_id;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ native_id = pthread_mach_thread_np(pthread_self());
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ if (&pthread_threadid_np != NULL) {
+ (void) pthread_threadid_np(NULL, &native_id);
+ } else {
+ native_id = pthread_mach_thread_np(pthread_self());
+ }
+#else
(void) pthread_threadid_np(NULL, &native_id);
+#endif
#elif defined(__linux__)
pid_t native_id;
native_id = syscall(SYS_gettid);

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.36 2023/10/23 06:36:01 wiz Exp $
$NetBSD: distinfo,v 1.37 2023/11/10 09:48:39 nia Exp $
BLAKE2s (Python-3.9.18.tar.xz) = 429256eb52e94427ae86302633ce8b01ba42d37c44c59e89fa0ae09b721da63f
SHA512 (Python-3.9.18.tar.xz) = aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7
@ -8,14 +8,17 @@ SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6
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__shutil.py) = 7b01da9cbfd9b7cd1bb88424d91964cf52ea72df
SHA1 (patch-Makefile.pre.in) = dd5ff571ac9fe2dc2e41fa678261d8e3648ac908
SHA1 (patch-Modules___hashopenssl.c) = d7157254630259b2073e67a921edf0dfe151e32a
SHA1 (patch-Modules___ssl.c) = f241ba148e4c244a641386be5ac07817b03f04f7
SHA1 (patch-Modules_clinic_posixmodule.c.h) = 66ce8a2fec0ee4df7cb1f814dd4c40d144d1407f
SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
SHA1 (patch-Modules_posixmodule.c) = cc90b73913f7759efba2e136ff04161444f49f27
SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de
SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c
SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
SHA1 (patch-Python_thread__pthread.h) = 25609f722ac9c17a49023ddc6882545d9d7798ff
SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531
SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e
SHA1 (patch-setup.py) = dab93079027f8ac6a259c9e683d35fe7b66c57e5

View file

@ -0,0 +1,25 @@
$NetBSD: patch-Lib_test_test__shutil.py,v 1.1 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Lib/test/test_shutil.py.orig 2023-08-24 17:59:28.000000000 +0000
+++ Lib/test/test_shutil.py
@@ -2569,7 +2569,7 @@ class TestZeroCopySendfile(_ZeroCopyFile
shutil._USE_CP_SENDFILE = True
-@unittest.skipIf(not MACOS, 'macOS only')
+@unittest.skipIf(not MACOS or not hasattr(posix, "_fcopyfile"), 'macOS with posix._fcopyfile only')
class TestZeroCopyMACOS(_ZeroCopyFileTest, unittest.TestCase):
PATCHPOINT = "posix._fcopyfile"

View file

@ -0,0 +1,25 @@
$NetBSD: patch-Modules_clinic_posixmodule.c.h,v 1.1 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Modules/clinic/posixmodule.c.h.orig 2023-08-24 17:59:28.000000000 +0000
+++ Modules/clinic/posixmodule.c.h
@@ -5546,7 +5546,7 @@ exit:
#endif /* defined(HAVE_SENDFILE) && !defined(__APPLE__) && !(defined(__FreeBSD__) || defined(__DragonFly__)) */
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
PyDoc_STRVAR(os__fcopyfile__doc__,
"_fcopyfile($module, in_fd, out_fd, flags, /)\n"

View file

@ -0,0 +1,52 @@
$NetBSD: patch-Modules_posixmodule.c,v 1.3 2023/11/10 09:48:40 nia Exp $
posix.copyfile does not exist on Tiger.
Python 3.8's posix._fcopyfile implementation unconditionally uses <copyfile.h>,
which only exists on Leopard ane newer. This patch removes posix._fcopyfile
on Tiger - this is okay because the rest of the stdlib uses posix._fcopyfile
only conditionally after checking that the function exists
(non-Apple systems don't have posix._fcopyfile either).
thanks to @dgelessus
https://github.com/macports/macports-ports/pull/5987
--- Modules/posixmodule.c.orig 2023-08-24 17:59:28.000000000 +0000
+++ Modules/posixmodule.c
@@ -57,6 +57,8 @@
*/
#if defined(__APPLE__)
+#include <AvailabilityMacros.h>
+
#if defined(__has_builtin)
#if __has_builtin(__builtin_available)
#define HAVE_BUILTIN_AVAILABLE 1
@@ -229,7 +231,7 @@ corresponding Unix manual entries for mo
# include <sys/sendfile.h>
#endif
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
# include <copyfile.h>
#endif
@@ -10000,7 +10002,7 @@ done:
#endif /* HAVE_SENDFILE */
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
/*[clinic input]
os._fcopyfile
@@ -15246,7 +15248,7 @@ all_ins(PyObject *m)
#endif
#endif
-#if defined(__APPLE__)
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;
#endif

View file

@ -1,8 +1,11 @@
$NetBSD: patch-Python_thread__pthread.h,v 1.1 2020/10/10 20:20:12 adam Exp $
$NetBSD: patch-Python_thread__pthread.h,v 1.2 2023/11/10 09:48:40 nia Exp $
--- Python/thread_pthread.h.orig 2013-05-15 16:33:00.000000000 +0000
https://bugs.python.org/issue46045
https://trac.macports.org/ticket/59772
--- Python/thread_pthread.h.orig 2023-08-24 17:59:28.000000000 +0000
+++ Python/thread_pthread.h
@@ -50,6 +50,9 @@
@@ -78,6 +78,9 @@
we need to add 0 to make it work there as well. */
#if (_POSIX_SEMAPHORES+0) == -1
#define HAVE_BROKEN_POSIX_SEMAPHORES
@ -12,3 +15,21 @@ $NetBSD: patch-Python_thread__pthread.h,v 1.1 2020/10/10 20:20:12 adam Exp $
#else
#include <semaphore.h>
#include <errno.h>
@@ -340,7 +343,17 @@ PyThread_get_thread_native_id(void)
PyThread_init_thread();
#ifdef __APPLE__
uint64_t native_id;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ native_id = pthread_mach_thread_np(pthread_self());
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ if (&pthread_threadid_np != NULL) {
+ (void) pthread_threadid_np(NULL, &native_id);
+ } else {
+ native_id = pthread_mach_thread_np(pthread_self());
+ }
+#else
(void) pthread_threadid_np(NULL, &native_id);
+#endif
#elif defined(__linux__)
pid_t native_id;
native_id = syscall(SYS_gettid);