Wed Nov 18 11:03:31 2020 UTC ()
lang/python37: Fix on CentOS 7

Same as lang/python38 fix just now:

Move __has_attribute() inside #if defined(__has_attribute) body so the
preprocessor doesn't break on that.


(sjmulder)
diff -r1.22 -r1.23 pkgsrc/lang/python37/distinfo
diff -r1.1 -r1.2 pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c
diff -r1.1 -r1.2 pkgsrc/lang/python37/patches/patch-Modules_timemodule.c

cvs diff -r1.22 -r1.23 pkgsrc/lang/python37/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/python37/distinfo 2020/11/17 19:33:26 1.22
+++ pkgsrc/lang/python37/distinfo 2020/11/18 11:03:31 1.23
@@ -1,42 +1,42 @@ @@ -1,42 +1,42 @@
1$NetBSD: distinfo,v 1.22 2020/11/17 19:33:26 sjmulder Exp $ 1$NetBSD: distinfo,v 1.23 2020/11/18 11:03:31 sjmulder Exp $
2 2
3SHA1 (Python-3.7.9.tar.xz) = e1de02779a89a94000c0ed340ec126de25825f2f 3SHA1 (Python-3.7.9.tar.xz) = e1de02779a89a94000c0ed340ec126de25825f2f
4RMD160 (Python-3.7.9.tar.xz) = 6ff3676f84b1a103b0e3161dcc7257936c914daf 4RMD160 (Python-3.7.9.tar.xz) = 6ff3676f84b1a103b0e3161dcc7257936c914daf
5SHA512 (Python-3.7.9.tar.xz) = e4217b25529b5336e43b63d17f3758a8177a58184564cf02bd92a312f58dba9e096485c9e3cb3544f966e847ea15b3ab30ed065d28a6ca52a6d7e0faddf7d9f9 5SHA512 (Python-3.7.9.tar.xz) = e4217b25529b5336e43b63d17f3758a8177a58184564cf02bd92a312f58dba9e096485c9e3cb3544f966e847ea15b3ab30ed065d28a6ca52a6d7e0faddf7d9f9
6Size (Python-3.7.9.tar.xz) = 17389636 bytes 6Size (Python-3.7.9.tar.xz) = 17389636 bytes
7SHA1 (patch-Lib___osx__support.py) = dbec9925c1a0b6b845101df9825af52d83317773 7SHA1 (patch-Lib___osx__support.py) = dbec9925c1a0b6b845101df9825af52d83317773
8SHA1 (patch-Lib_ctypes_____init____.py) = ded12eb372028288d85ba88b43e45549c6f48144 8SHA1 (patch-Lib_ctypes_____init____.py) = ded12eb372028288d85ba88b43e45549c6f48144
9SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 267f0b39f116bc9df0b24c277b48ce59cfecd397 9SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 267f0b39f116bc9df0b24c277b48ce59cfecd397
10SHA1 (patch-Lib_ctypes_test_test__macholib.py) = 76bb73619e5a27aa1009d4c65e3be1f69b9b6e91 10SHA1 (patch-Lib_ctypes_test_test__macholib.py) = 76bb73619e5a27aa1009d4c65e3be1f69b9b6e91
11SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 11SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3
12SHA1 (patch-Lib_distutils_command_install.py) = 6fc6f5d918b7581fc62cd0fe55857ee932c3a341 12SHA1 (patch-Lib_distutils_command_install.py) = 6fc6f5d918b7581fc62cd0fe55857ee932c3a341
13SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf 13SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf
14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69
15SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2 15SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2
16SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c 16SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c
17SHA1 (patch-Lib_test_test__bytes.py) = 9b97cd1cd753a0a7afdc601b606367655d4c47b1 17SHA1 (patch-Lib_test_test__bytes.py) = 9b97cd1cd753a0a7afdc601b606367655d4c47b1
18SHA1 (patch-Lib_test_test__platform.py) = b473d766ecdbba93cdcc66a4550c2d02bf37ae79 18SHA1 (patch-Lib_test_test__platform.py) = b473d766ecdbba93cdcc66a4550c2d02bf37ae79
19SHA1 (patch-Lib_test_test__posix.py) = 3fcc7b483f1797d273b2337daeac514bd60a1e78 19SHA1 (patch-Lib_test_test__posix.py) = 3fcc7b483f1797d273b2337daeac514bd60a1e78
20SHA1 (patch-Lib_test_test__time.py) = e20c40aad6442422fae08ab937b9d128ad4b8fdc 20SHA1 (patch-Lib_test_test__time.py) = e20c40aad6442422fae08ab937b9d128ad4b8fdc
21SHA1 (patch-Lib_test_test__unicode.py) = 4dfccf72ae60d1e1092ff84b7c05a735865ba8a8 21SHA1 (patch-Lib_test_test__unicode.py) = 4dfccf72ae60d1e1092ff84b7c05a735865ba8a8
22SHA1 (patch-Mac_BuildScript_build-installer.py) = a377ed164ee2ba72ce0f72ccf9507e775f7b7deb 22SHA1 (patch-Mac_BuildScript_build-installer.py) = a377ed164ee2ba72ce0f72ccf9507e775f7b7deb
23SHA1 (patch-Mac_Tools_pythonw.c) = 94f27032aac27263bc1c1bd66574121fbca1e380 23SHA1 (patch-Mac_Tools_pythonw.c) = 94f27032aac27263bc1c1bd66574121fbca1e380
24SHA1 (patch-Makefile.pre.in) = 1393dac225c5a7edcb7947eb707b4526ea884f95 24SHA1 (patch-Makefile.pre.in) = 1393dac225c5a7edcb7947eb707b4526ea884f95
25SHA1 (patch-Modules___ctypes_callbacks.c) = 98bd449f9c4bf3acbcfdd24d017f490fc0c9326e 25SHA1 (patch-Modules___ctypes_callbacks.c) = 739462325d430d2b57483738d94a3174e36e50e1
26SHA1 (patch-Modules___ctypes_callproc.c) = d0905ede69f2c61d917380d6da73c14e7e31d41f 26SHA1 (patch-Modules___ctypes_callproc.c) = d0905ede69f2c61d917380d6da73c14e7e31d41f
27SHA1 (patch-Modules___ctypes_ctypes.h) = 2589d24c101771f8696b456d594e5f53305cf72c 27SHA1 (patch-Modules___ctypes_ctypes.h) = 2589d24c101771f8696b456d594e5f53305cf72c
28SHA1 (patch-Modules___ctypes_malloc__closure.c) = 780e7dfa293c57dc28e97358937ed7d148414c8e 28SHA1 (patch-Modules___ctypes_malloc__closure.c) = 780e7dfa293c57dc28e97358937ed7d148414c8e
29SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3840dc184f1f5faa590cdca57df911d5c71a9439 29SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3840dc184f1f5faa590cdca57df911d5c71a9439
30SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 30SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
31SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d 31SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
32SHA1 (patch-Modules_posixmodule.c) = cae3797179c1a4d820dd294b69ca4b9a6fa81899 32SHA1 (patch-Modules_posixmodule.c) = cae3797179c1a4d820dd294b69ca4b9a6fa81899
33SHA1 (patch-Modules_socketmodule.c) = c0bdb256bccc176c2406feec4080cd91fcb693b2 33SHA1 (patch-Modules_socketmodule.c) = c0bdb256bccc176c2406feec4080cd91fcb693b2
34SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c 34SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
35SHA1 (patch-Modules_timemodule.c) = c0fa13e7f02046b1dfde36a50898b4c46ca3792e 35SHA1 (patch-Modules_timemodule.c) = e4be632485280002eb76a8e6e524676429044c15
36SHA1 (patch-Python_bootstrap__hash.c) = c60b3987e549987a1180edaab0ad2d48fc272925 36SHA1 (patch-Python_bootstrap__hash.c) = c60b3987e549987a1180edaab0ad2d48fc272925
37SHA1 (patch-Python_pytime.c) = 5d782457439708f5e8e46043eed5fe7ba40f45f9 37SHA1 (patch-Python_pytime.c) = 5d782457439708f5e8e46043eed5fe7ba40f45f9
38SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be 38SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
39SHA1 (patch-configure) = 2c7d3fb29c2fc9a7a75adbddf7399f5e69baeaca 39SHA1 (patch-configure) = 2c7d3fb29c2fc9a7a75adbddf7399f5e69baeaca
40SHA1 (patch-configure.ac) = 948e925ef2595058a902ad60762158f16d13db80 40SHA1 (patch-configure.ac) = 948e925ef2595058a902ad60762158f16d13db80
41SHA1 (patch-pyconfig.h.in) = 1a837a44c9b4f6e538909dba70482082e5a6b80f 41SHA1 (patch-pyconfig.h.in) = 1a837a44c9b4f6e538909dba70482082e5a6b80f
42SHA1 (patch-setup.py) = d42d76b6edc5b5b7855b2888e0df7ab723ade6a5 42SHA1 (patch-setup.py) = d42d76b6edc5b5b7855b2888e0df7ab723ade6a5

cvs diff -r1.1 -r1.2 pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c (expand / switch to unified diff)

--- pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c 2020/11/17 19:33:26 1.1
+++ pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c 2020/11/18 11:03:31 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-Modules___ctypes_callbacks.c,v 1.1 2020/11/17 19:33:26 sjmulder Exp $ 1$NetBSD: patch-Modules___ctypes_callbacks.c,v 1.2 2020/11/18 11:03:31 sjmulder Exp $
2 2
3Support for macOS 11 and Apple Silicon (ARM). Mostly backported from: 3Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
4https://github.com/python/cpython/pull/22855 4https://github.com/python/cpython/pull/22855
5 5
6--- Modules/_ctypes/callbacks.c.orig 2020-08-15 05:20:16.000000000 +0000 6--- Modules/_ctypes/callbacks.c.orig 2020-08-15 05:20:16.000000000 +0000
7+++ Modules/_ctypes/callbacks.c 7+++ Modules/_ctypes/callbacks.c
8@@ -1,6 +1,8 @@ 8@@ -1,6 +1,8 @@
9 #include "Python.h" 9 #include "Python.h"
10 #include "frameobject.h" 10 #include "frameobject.h"
11  11
12+#include <stdbool.h> 12+#include <stdbool.h>
13+ 13+
14 #include <ffi.h> 14 #include <ffi.h>
@@ -52,25 +52,25 @@ https://github.com/python/cpython/pull/2 @@ -52,25 +52,25 @@ https://github.com/python/cpython/pull/2
52+ } else 52+ } else
53+#endif 53+#endif
54+ { 54+ {
55+#if USING_APPLE_OS_LIBFFI && defined(__arm64__) 55+#if USING_APPLE_OS_LIBFFI && defined(__arm64__)
56+ PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing"); 56+ PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing");
57+ goto error; 57+ goto error;
58 #else 58 #else
59- result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn, 59- result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
60- p, 60- p,
61- p->pcl_exec); 61- p->pcl_exec);
62+#ifdef MACOSX 62+#ifdef MACOSX
63+ #pragma clang diagnostic push 63+ #pragma clang diagnostic push
64+ #pragma clang diagnostic ignored "-Wdeprecated-declarations" 64+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
65 #endif 65+#endif
66+ result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p); 66+ result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p);
67+ 67+
68+#ifdef MACOSX 68+#ifdef MACOSX
69+ #pragma clang diagnostic pop 69+ #pragma clang diagnostic pop
70+#endif 70+#endif
71+ 71+
72+#endif 72 #endif
73+ } 73+ }
74 if (result != FFI_OK) { 74 if (result != FFI_OK) {
75 PyErr_Format(PyExc_RuntimeError, 75 PyErr_Format(PyExc_RuntimeError,
76 "ffi_prep_closure failed with %d", result); 76 "ffi_prep_closure failed with %d", result);

cvs diff -r1.1 -r1.2 pkgsrc/lang/python37/patches/patch-Modules_timemodule.c (expand / switch to unified diff)

--- pkgsrc/lang/python37/patches/patch-Modules_timemodule.c 2020/11/17 19:33:26 1.1
+++ pkgsrc/lang/python37/patches/patch-Modules_timemodule.c 2020/11/18 11:03:31 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-Modules_timemodule.c,v 1.1 2020/11/17 19:33:26 sjmulder Exp $ 1$NetBSD: patch-Modules_timemodule.c,v 1.2 2020/11/18 11:03:31 sjmulder Exp $
2 2
3Support for macOS 11 and Apple Silicon (ARM). Mostly backported from: 3Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
4https://github.com/python/cpython/pull/22855 4https://github.com/python/cpython/pull/22855
5 5
6--- Modules/timemodule.c.orig 2020-08-15 05:20:16.000000000 +0000 6--- Modules/timemodule.c.orig 2020-08-15 05:20:16.000000000 +0000
7+++ Modules/timemodule.c 7+++ Modules/timemodule.c
8@@ -48,6 +48,15 @@ 8@@ -48,6 +48,15 @@
9 #define _Py_tzname tzname 9 #define _Py_tzname tzname
10 #endif 10 #endif
11  11
12+#if defined(__APPLE__ ) && defined(__has_builtin) 12+#if defined(__APPLE__ ) && defined(__has_builtin)
13+# if __has_builtin(__builtin_available) 13+# if __has_builtin(__builtin_available)
14+# define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) 14+# define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
@@ -94,93 +94,95 @@ https://github.com/python/cpython/pull/2 @@ -94,93 +94,95 @@ https://github.com/python/cpython/pull/2
94- } 94- }
95  95
96- if (_PyTime_FromTimespec(tp, &ts) < 0) { 96- if (_PyTime_FromTimespec(tp, &ts) < 0) {
97- return -1; 97- return -1;
98+ if (_PyTime_FromTimespec(tp, &ts) < 0) { 98+ if (_PyTime_FromTimespec(tp, &ts) < 0) {
99+ return -1; 99+ return -1;
100+ } 100+ }
101+ return 0; 101+ return 0;
102 } 102 }
103- return 0; 103- return 0;
104 } 104 }
105 #endif 105 #endif
106  106
107@@ -1327,6 +1355,16 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t  107@@ -1327,6 +1355,18 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
108  108
109 #elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) 109 #elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
110 #define HAVE_THREAD_TIME 110 #define HAVE_THREAD_TIME
111+ 111+
112+#if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability) 112+#if defined(__APPLE__) && defined(__has_attribute)
 113+# if __has_attribute(availability)
113+static int 114+static int
114+_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)  115+_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
115+ __attribute__((availability(macos, introduced=10.12))) 116+ __attribute__((availability(macos, introduced=10.12)))
116+ __attribute__((availability(ios, introduced=10.0))) 117+ __attribute__((availability(ios, introduced=10.0)))
117+ __attribute__((availability(tvos, introduced=10.0))) 118+ __attribute__((availability(tvos, introduced=10.0)))
118+ __attribute__((availability(watchos, introduced=3.0))); 119+ __attribute__((availability(watchos, introduced=3.0)));
 120+# endif
119+#endif 121+#endif
120+ 122+
121 static int 123 static int
122 _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) 124 _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
123 { 125 {
124@@ -1358,6 +1396,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t  126@@ -1358,6 +1398,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
125 #endif 127 #endif
126  128
127 #ifdef HAVE_THREAD_TIME 129 #ifdef HAVE_THREAD_TIME
128+#ifdef __APPLE__ 130+#ifdef __APPLE__
129+/*  131+/*
130+ * The clock_* functions will be removed from the module 132+ * The clock_* functions will be removed from the module
131+ * dict entirely when the C API is not available. 133+ * dict entirely when the C API is not available.
132+ */ 134+ */
133+#pragma clang diagnostic push 135+#pragma clang diagnostic push
134+#pragma clang diagnostic ignored "-Wunguarded-availability" 136+#pragma clang diagnostic ignored "-Wunguarded-availability"
135+#endif 137+#endif
136+ 138+
137 static PyObject * 139 static PyObject *
138 time_thread_time(PyObject *self, PyObject *unused) 140 time_thread_time(PyObject *self, PyObject *unused)
139 { 141 {
140@@ -1388,6 +1435,11 @@ PyDoc_STRVAR(thread_time_ns_doc, 142@@ -1388,6 +1437,11 @@ PyDoc_STRVAR(thread_time_ns_doc,
141 \n\ 143 \n\
142 Thread time for profiling as nanoseconds:\n\ 144 Thread time for profiling as nanoseconds:\n\
143 sum of the kernel and user-space CPU time."); 145 sum of the kernel and user-space CPU time.");
144+ 146+
145+#ifdef __APPLE__ 147+#ifdef __APPLE__
146+#pragma clang diagnostic pop 148+#pragma clang diagnostic pop
147+#endif 149+#endif
148+ 150+
149 #endif 151 #endif
150  152
151  153
152@@ -1446,9 +1498,19 @@ time_get_clock_info(PyObject *self, PyOb 154@@ -1446,9 +1500,19 @@ time_get_clock_info(PyObject *self, PyOb
153 } 155 }
154 #ifdef HAVE_THREAD_TIME 156 #ifdef HAVE_THREAD_TIME
155 else if (strcmp(name, "thread_time") == 0) { 157 else if (strcmp(name, "thread_time") == 0) {
156- if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) { 158- if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) {
157+ 159+
158+#ifdef __APPLE__ 160+#ifdef __APPLE__
159+ if (HAVE_CLOCK_GETTIME_RUNTIME) { 161+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
160+#endif 162+#endif
161+ if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) { 163+ if (_PyTime_GetThreadTimeWithInfo(&t, &info) < 0) {
162+ return NULL; 164+ return NULL;
163+ } 165+ }
164+#ifdef __APPLE__ 166+#ifdef __APPLE__
165+ } else { 167+ } else {
166+ PyErr_SetString(PyExc_ValueError, "unknown clock"); 168+ PyErr_SetString(PyExc_ValueError, "unknown clock");
167 return NULL; 169 return NULL;
168 } 170 }
169+#endif 171+#endif
170 } 172 }
171 #endif 173 #endif
172 else { 174 else {
173@@ -1761,40 +1823,85 @@ PyInit_time(void) 175@@ -1761,40 +1825,85 @@ PyInit_time(void)
174 if (m == NULL) 176 if (m == NULL)
175 return NULL; 177 return NULL;
176  178
177+#if defined(__APPLE__) && defined(HAVE_CLOCK_GETTIME) 179+#if defined(__APPLE__) && defined(HAVE_CLOCK_GETTIME)
178+ if (HAVE_CLOCK_GETTIME_RUNTIME) { 180+ if (HAVE_CLOCK_GETTIME_RUNTIME) {
179+ /* pass: ^^^ cannot use '!' here */ 181+ /* pass: ^^^ cannot use '!' here */
180+ } else { 182+ } else {
181+ PyObject* dct = PyModule_GetDict(m); 183+ PyObject* dct = PyModule_GetDict(m);
182+ if (dct == NULL) { 184+ if (dct == NULL) {
183+ return NULL; 185+ return NULL;
184+ } 186+ }
185+ 187+
186+ if (PyDict_DelItemString(dct, "clock_gettime") == -1) { 188+ if (PyDict_DelItemString(dct, "clock_gettime") == -1) {