Wed Nov 18 10:51:01 2020 UTC ()
lang/python38: Fix on CentOS 7

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


(sjmulder)
diff -r1.13 -r1.14 pkgsrc/lang/python38/distinfo
diff -r1.1 -r1.2 pkgsrc/lang/python38/patches/patch-Modules_timemodule.c

cvs diff -r1.13 -r1.14 pkgsrc/lang/python38/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/python38/distinfo 2020/11/17 19:33:14 1.13
+++ pkgsrc/lang/python38/distinfo 2020/11/18 10:51:01 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.13 2020/11/17 19:33:14 sjmulder Exp $ 1$NetBSD: distinfo,v 1.14 2020/11/18 10:51:01 sjmulder Exp $
2 2
3SHA1 (Python-3.8.6.tar.xz) = 6ee446eaacf901a3305565bd6569e2de135168e3 3SHA1 (Python-3.8.6.tar.xz) = 6ee446eaacf901a3305565bd6569e2de135168e3
4RMD160 (Python-3.8.6.tar.xz) = 89c134d2d1bc02975cf959cc4a7ee63dba5c5388 4RMD160 (Python-3.8.6.tar.xz) = 89c134d2d1bc02975cf959cc4a7ee63dba5c5388
5SHA512 (Python-3.8.6.tar.xz) = 22faec84f6e172e1ac7c6bd6fd37e9b6ae4afc91cf5136aa8cac8ebbed8d18793f9196e8749b8ccc43447cb6c41cb450f65ea72dd363c06dfaeb14e0455f5560 5SHA512 (Python-3.8.6.tar.xz) = 22faec84f6e172e1ac7c6bd6fd37e9b6ae4afc91cf5136aa8cac8ebbed8d18793f9196e8749b8ccc43447cb6c41cb450f65ea72dd363c06dfaeb14e0455f5560
6Size (Python-3.8.6.tar.xz) = 18233864 bytes 6Size (Python-3.8.6.tar.xz) = 18233864 bytes
7SHA1 (patch-Lib___osx__support.py) = 95c729132e5bdbda72789f02b37ed111d0d9d11e 7SHA1 (patch-Lib___osx__support.py) = 95c729132e5bdbda72789f02b37ed111d0d9d11e
8SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 3acfa836e06bb1ca994357bc4b687af1ce1641e0 8SHA1 (patch-Lib_ctypes_macholib_dyld.py) = 3acfa836e06bb1ca994357bc4b687af1ce1641e0
9SHA1 (patch-Lib_ctypes_test_test__macholib.py) = db352894c47cbb4bed4905b4a7dde272577c65d8 9SHA1 (patch-Lib_ctypes_test_test__macholib.py) = db352894c47cbb4bed4905b4a7dde272577c65d8
10SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 10SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3
11SHA1 (patch-Lib_distutils_command_install.py) = 6fc6f5d918b7581fc62cd0fe55857ee932c3a341 11SHA1 (patch-Lib_distutils_command_install.py) = 6fc6f5d918b7581fc62cd0fe55857ee932c3a341
12SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf 12SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf
13SHA1 (patch-Lib_distutils_tests_test__build__ext.py) = 481dce36ddb258707470d18f84c300700326dc1e 13SHA1 (patch-Lib_distutils_tests_test__build__ext.py) = 481dce36ddb258707470d18f84c300700326dc1e
14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69
@@ -21,21 +21,21 @@ SHA1 (patch-Mac_BuildScript_build-instal @@ -21,21 +21,21 @@ SHA1 (patch-Mac_BuildScript_build-instal
21SHA1 (patch-Mac_Tools_pythonw.c) = aa2e7bfc5c515d48916f817d04fe2bb9775ea3c3 21SHA1 (patch-Mac_Tools_pythonw.c) = aa2e7bfc5c515d48916f817d04fe2bb9775ea3c3
22SHA1 (patch-Makefile.pre.in) = d42f9f5bca1dd663f64122dc95b49111452fe6e8 22SHA1 (patch-Makefile.pre.in) = d42f9f5bca1dd663f64122dc95b49111452fe6e8
23SHA1 (patch-Modules___ctypes_callbacks.c) = 99d821b1db08e680bc8ed3faecbda07f31e389e0 23SHA1 (patch-Modules___ctypes_callbacks.c) = 99d821b1db08e680bc8ed3faecbda07f31e389e0
24SHA1 (patch-Modules___ctypes_callproc.c) = ec013388ecf599d3faad20a3945e852bed94a5e7 24SHA1 (patch-Modules___ctypes_callproc.c) = ec013388ecf599d3faad20a3945e852bed94a5e7
25SHA1 (patch-Modules___ctypes_ctypes.h) = bfa5574db6be78f71584e6b0b92965804cb469ba 25SHA1 (patch-Modules___ctypes_ctypes.h) = bfa5574db6be78f71584e6b0b92965804cb469ba
26SHA1 (patch-Modules___ctypes_malloc__closure.c) = eadb811e15c4b821790480d7c4a4908753773e0f 26SHA1 (patch-Modules___ctypes_malloc__closure.c) = eadb811e15c4b821790480d7c4a4908753773e0f
27SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3710f2e524a8786470d01e7b2fc812600f0ec169 27SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 3710f2e524a8786470d01e7b2fc812600f0ec169
28SHA1 (patch-Modules_getpath.c) = c6930e41e57e31e3f46b4b9e0d0f5fcc8a0e5163 28SHA1 (patch-Modules_getpath.c) = c6930e41e57e31e3f46b4b9e0d0f5fcc8a0e5163
29SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 29SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
30SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d 30SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
31SHA1 (patch-Modules_posixmodule.c) = ea24a1aa19b596b5d4457a4eff761e516406145f 31SHA1 (patch-Modules_posixmodule.c) = ea24a1aa19b596b5d4457a4eff761e516406145f
32SHA1 (patch-Modules_socketmodule.c) = e99fd9e30e3feafef1747a2f52446d8fec543362 32SHA1 (patch-Modules_socketmodule.c) = e99fd9e30e3feafef1747a2f52446d8fec543362
33SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c 33SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
34SHA1 (patch-Modules_timemodule.c) = bc8ba8c63e6be1411067480d661bd3b23dfa14c0 34SHA1 (patch-Modules_timemodule.c) = 10dc2769432bbfd4360f90fedfa6504d8b6f6347
35SHA1 (patch-Python_bootstrap__hash.c) = 2e7d24ded1369624b2983b15784988517a9697a5 35SHA1 (patch-Python_bootstrap__hash.c) = 2e7d24ded1369624b2983b15784988517a9697a5
36SHA1 (patch-Python_pytime.c) = 41981f821e0b420abcb0334312148deb9a9fed5e 36SHA1 (patch-Python_pytime.c) = 41981f821e0b420abcb0334312148deb9a9fed5e
37SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be 37SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
38SHA1 (patch-configure) = c63ae7364c69fed98d366fd2b6a727a71b10defc 38SHA1 (patch-configure) = c63ae7364c69fed98d366fd2b6a727a71b10defc
39SHA1 (patch-configure.ac) = 2b341061350671d820d696a659176a35a93d800d 39SHA1 (patch-configure.ac) = 2b341061350671d820d696a659176a35a93d800d
40SHA1 (patch-pyconfig.h.in) = 6e24f401286768641c7d69dd75cfe18f1d8df1e7 40SHA1 (patch-pyconfig.h.in) = 6e24f401286768641c7d69dd75cfe18f1d8df1e7
41SHA1 (patch-setup.py) = 2211bfe01c6c53f5c9852f9569a31975f7b7cb5e 41SHA1 (patch-setup.py) = 2211bfe01c6c53f5c9852f9569a31975f7b7cb5e

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

--- pkgsrc/lang/python38/patches/patch-Modules_timemodule.c 2020/11/17 19:33:15 1.1
+++ pkgsrc/lang/python38/patches/patch-Modules_timemodule.c 2020/11/18 10:51:01 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-Modules_timemodule.c,v 1.1 2020/11/17 19:33:15 sjmulder Exp $ 1$NetBSD: patch-Modules_timemodule.c,v 1.2 2020/11/18 10:51:01 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-09-23 12:36:32.000000000 +0000 6--- Modules/timemodule.c.orig 2020-09-23 12:36:32.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@@ -1346,6 +1374,16 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t  107@@ -1346,6 +1374,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@@ -1377,6 +1415,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t  126@@ -1377,6 +1417,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@@ -1407,6 +1454,11 @@ PyDoc_STRVAR(thread_time_ns_doc, 142@@ -1407,6 +1456,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@@ -1456,9 +1508,19 @@ time_get_clock_info(PyObject *self, PyOb 154@@ -1456,9 +1510,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@@ -1757,43 +1819,88 @@ PyInit_time(void) 175@@ -1757,43 +1821,88 @@ 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 -1; 185+ return -1;
184+ } 186+ }
185+ 187+
186+ if (PyDict_DelItemString(dct, "clock_gettime") == -1) { 188+ if (PyDict_DelItemString(dct, "clock_gettime") == -1) {