Thu Nov 19 16:29:43 2020 UTC ()
python3{7,8,9}: build fix when include files have invalid UTF-8

I happen to have include/gts.h installed, which includes an accented
ISO-8859-1 character in its copyright message. This trips up the configuration
of Python in pkgsrc.

Ignore files with invalid unicode characters.

Also regenerate one other patch. No revision bump since the result is the same.


(bsiegert)
diff -r1.23 -r1.24 pkgsrc/lang/python37/distinfo
diff -r1.2 -r1.3 pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c
diff -r1.2 -r1.3 pkgsrc/lang/python37/patches/patch-setup.py
diff -r1.14 -r1.15 pkgsrc/lang/python38/distinfo
diff -r1.4 -r1.5 pkgsrc/lang/python38/patches/patch-setup.py
diff -r1.3 -r1.4 pkgsrc/lang/python39/distinfo
diff -r1.2 -r1.3 pkgsrc/lang/python39/patches/patch-setup.py

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

--- pkgsrc/lang/python37/distinfo 2020/11/18 11:03:31 1.23
+++ pkgsrc/lang/python37/distinfo 2020/11/19 16:29:42 1.24
@@ -1,42 +1,42 @@ @@ -1,42 +1,42 @@
1$NetBSD: distinfo,v 1.23 2020/11/18 11:03:31 sjmulder Exp $ 1$NetBSD: distinfo,v 1.24 2020/11/19 16:29:42 bsiegert 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) = 739462325d430d2b57483738d94a3174e36e50e1 25SHA1 (patch-Modules___ctypes_callbacks.c) = 98bd449f9c4bf3acbcfdd24d017f490fc0c9326e
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) = e4be632485280002eb76a8e6e524676429044c15 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) = 1013fb71ab176305dfd598cd1c2c798603000f18

cvs diff -r1.2 -r1.3 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/18 11:03:31 1.2
+++ pkgsrc/lang/python37/patches/patch-Modules___ctypes_callbacks.c 2020/11/19 16:29:42 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-Modules___ctypes_callbacks.c,v 1.2 2020/11/18 11:03:31 sjmulder Exp $ 1$NetBSD: patch-Modules___ctypes_callbacks.c,v 1.3 2020/11/19 16:29:42 bsiegert 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.2 -r1.3 pkgsrc/lang/python37/patches/patch-setup.py (expand / switch to unified diff)

--- pkgsrc/lang/python37/patches/patch-setup.py 2020/11/17 19:33:26 1.2
+++ pkgsrc/lang/python37/patches/patch-setup.py 2020/11/19 16:29:42 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-setup.py,v 1.2 2020/11/17 19:33:26 sjmulder Exp $ 1$NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
2 2
3Disable certain modules, so they can be built as separate packages. 3Disable certain modules, so they can be built as separate packages.
4 4
5Do not look for ncursesw. 5Do not look for ncursesw.
6 6
7Assume panel_library is correct; this is a fix for ncurses' gnupanel 7Assume panel_library is correct; this is a fix for ncurses' gnupanel
8which will get transformed to panel in buildlink. 8which will get transformed to panel in buildlink.
9 9
10Also look for uuid/uuid.h. 10Also look for uuid/uuid.h.
11 11
12Support for macOS 11 and Apple Silicon (ARM). Mostly backported from: 12Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
13https://github.com/python/cpython/pull/22855 13https://github.com/python/cpython/pull/22855
14 14
@@ -21,85 +21,88 @@ https://github.com/python/cpython/pull/2 @@ -21,85 +21,88 @@ https://github.com/python/cpython/pull/2
21+from distutils import text_file 21+from distutils import text_file
22 from distutils.errors import * 22 from distutils.errors import *
23 from distutils.core import Extension, setup 23 from distutils.core import Extension, setup
24 from distutils.command.build_ext import build_ext 24 from distutils.command.build_ext import build_ext
25@@ -48,7 +49,7 @@ host_platform = get_platform() 25@@ -48,7 +49,7 @@ host_platform = get_platform()
26 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) 26 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
27  27
28 # This global variable is used to hold the list of modules to be disabled. 28 # This global variable is used to hold the list of modules to be disabled.
29-disabled_module_list = [] 29-disabled_module_list = []
30+disabled_module_list = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"] 30+disabled_module_list = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
31  31
32 def add_dir_to_list(dirlist, dir): 32 def add_dir_to_list(dirlist, dir):
33 """Add the directory 'dir' to the list 'dirlist' (after any relative 33 """Add the directory 'dir' to the list 'dirlist' (after any relative
34@@ -150,6 +151,13 @@ def is_macosx_sdk_path(path): 34@@ -150,6 +151,16 @@ def is_macosx_sdk_path(path):
35 or path.startswith('/System/') 35 or path.startswith('/System/')
36 or path.startswith('/Library/') ) 36 or path.startswith('/Library/') )
37  37
38+def grep_headers_for(function, headers): 38+def grep_headers_for(function, headers):
39+ for header in headers: 39+ for header in headers:
40+ with open(header, 'r') as f: 40+ try:
41+ if function in f.read(): 41+ with open(header, 'r') as f:
42+ return True 42+ if function in f.read():
 43+ return True
 44+ except UnicodeDecodeError:
 45+ pass
43+ return False 46+ return False
44+ 47+
45 def find_file(filename, std_dirs, paths): 48 def find_file(filename, std_dirs, paths):
46 """Searches for the directory where a given file is located, 49 """Searches for the directory where a given file is located,
47 and returns a possibly-empty list of additional directories, or None 50 and returns a possibly-empty list of additional directories, or None
48@@ -581,15 +589,15 @@ class PyBuildExt(build_ext): 51@@ -581,15 +592,15 @@ class PyBuildExt(build_ext):
49 os.unlink(tmpfile) 52 os.unlink(tmpfile)
50  53
51 def detect_modules(self): 54 def detect_modules(self):
52- # Ensure that /usr/local is always used, but the local build 55- # Ensure that /usr/local is always used, but the local build
53- # directories (i.e. '.' and 'Include') must be first. See issue 56- # directories (i.e. '.' and 'Include') must be first. See issue
54- # 10520. 57- # 10520.
55- if not cross_compiling: 58- if not cross_compiling:
56- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 59- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
57- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 60- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
58- # only change this for cross builds for 3.3, issues on Mageia 61- # only change this for cross builds for 3.3, issues on Mageia
59- if cross_compiling: 62- if cross_compiling:
60- self.add_gcc_paths() 63- self.add_gcc_paths()
61+ # Add the buildlink directories for pkgsrc 64+ # Add the buildlink directories for pkgsrc
62+ if os.environ.get('BUILDLINK_DIR'): 65+ if os.environ.get('BUILDLINK_DIR'):
63+ dir = os.environ['BUILDLINK_DIR'] 66+ dir = os.environ['BUILDLINK_DIR']
64+ libdir = dir + '/lib' 67+ libdir = dir + '/lib'
65+ incdir = dir + '/include' 68+ incdir = dir + '/include'
66+ if libdir not in self.compiler.library_dirs: 69+ if libdir not in self.compiler.library_dirs:
67+ self.compiler.library_dirs.insert(0, libdir) 70+ self.compiler.library_dirs.insert(0, libdir)
68+ if incdir not in self.compiler.include_dirs: 71+ if incdir not in self.compiler.include_dirs:
69+ self.compiler.include_dirs.insert(0, incdir) 72+ self.compiler.include_dirs.insert(0, incdir)
70 self.add_multiarch_paths() 73 self.add_multiarch_paths()
71  74
72 # Add paths specified in the environment variables LDFLAGS and 75 # Add paths specified in the environment variables LDFLAGS and
73@@ -673,6 +681,9 @@ class PyBuildExt(build_ext): 76@@ -673,6 +684,9 @@ class PyBuildExt(build_ext):
74 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] 77 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
75  78
76 if host_platform == 'darwin': 79 if host_platform == 'darwin':
77+ inc_dirs.append(macosx_sdk_root() + '/usr/include') 80+ inc_dirs.append(macosx_sdk_root() + '/usr/include')
78+ lib_dirs.append(macosx_sdk_root() + '/usr/lib') 81+ lib_dirs.append(macosx_sdk_root() + '/usr/lib')
79+ 82+
80 # This should work on any unixy platform ;-) 83 # This should work on any unixy platform ;-)
81 # If the user has bothered specifying additional -I and -L flags 84 # If the user has bothered specifying additional -I and -L flags
82 # in OPT and LDFLAGS we might as well use them here. 85 # in OPT and LDFLAGS we might as well use them here.
83@@ -854,8 +865,6 @@ class PyBuildExt(build_ext): 86@@ -854,8 +868,6 @@ class PyBuildExt(build_ext):
84 # use the same library for the readline and curses modules. 87 # use the same library for the readline and curses modules.
85 if 'curses' in readline_termcap_library: 88 if 'curses' in readline_termcap_library:
86 curses_library = readline_termcap_library 89 curses_library = readline_termcap_library
87- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): 90- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
88- curses_library = 'ncursesw' 91- curses_library = 'ncursesw'
89 elif self.compiler.find_library_file(lib_dirs, 'ncurses'): 92 elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
90 curses_library = 'ncurses' 93 curses_library = 'ncurses'
91 elif self.compiler.find_library_file(lib_dirs, 'curses'): 94 elif self.compiler.find_library_file(lib_dirs, 'curses'):
92@@ -1285,6 +1294,30 @@ class PyBuildExt(build_ext): 95@@ -1285,6 +1297,30 @@ class PyBuildExt(build_ext):
93 dbm_order = ['gdbm'] 96 dbm_order = ['gdbm']
94 # The standard Unix dbm module: 97 # The standard Unix dbm module:
95 if host_platform not in ['cygwin']: 98 if host_platform not in ['cygwin']:
96+ 99+
97+ ## Top half based on find_file 100+ ## Top half based on find_file
98+ def find_ndbm_h(dirs): 101+ def find_ndbm_h(dirs):
99+ ret = None 102+ ret = None
100+ if sys.platform == 'darwin': 103+ if sys.platform == 'darwin':
101+ sysroot = macosx_sdk_root() 104+ sysroot = macosx_sdk_root()
102+ for dir in dirs: 105+ for dir in dirs:
103+ f = os.path.join(dir, 'ndbm.h') 106+ f = os.path.join(dir, 'ndbm.h')
104+ if sys.platform == 'darwin' and is_macosx_sdk_path(dir): 107+ if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
105+ f = os.path.join(sysroot, dir[1:], 'ndbm.h') 108+ f = os.path.join(sysroot, dir[1:], 'ndbm.h')
@@ -110,55 +113,55 @@ https://github.com/python/cpython/pull/2 @@ -110,55 +113,55 @@ https://github.com/python/cpython/pull/2
110+ while 1: 113+ while 1:
111+ line = input.readline() 114+ line = input.readline()
112+ if not line: break 115+ if not line: break
113+ if re.search('This file is part of GDBM', line): 116+ if re.search('This file is part of GDBM', line):
114+ ret = None 117+ ret = None
115+ break 118+ break
116+ input.close() 119+ input.close()
117+ break 120+ break
118+ return ret 121+ return ret
119+ 122+
120 config_args = [arg.strip("'") 123 config_args = [arg.strip("'")
121 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] 124 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
122 dbm_args = [arg for arg in config_args 125 dbm_args = [arg for arg in config_args
123@@ -1296,7 +1329,7 @@ class PyBuildExt(build_ext): 126@@ -1296,7 +1332,7 @@ class PyBuildExt(build_ext):
124 dbmext = None 127 dbmext = None
125 for cand in dbm_order: 128 for cand in dbm_order:
126 if cand == "ndbm": 129 if cand == "ndbm":
127- if find_file("ndbm.h", inc_dirs, []) is not None: 130- if find_file("ndbm.h", inc_dirs, []) is not None:
128+ if find_ndbm_h(inc_dirs) is not None: 131+ if find_ndbm_h(inc_dirs) is not None:
129 # Some systems have -lndbm, others have -lgdbm_compat, 132 # Some systems have -lndbm, others have -lgdbm_compat,
130 # others don't have either 133 # others don't have either
131 if self.compiler.find_library_file(lib_dirs, 134 if self.compiler.find_library_file(lib_dirs,
132@@ -1428,8 +1461,7 @@ class PyBuildExt(build_ext): 135@@ -1428,8 +1464,7 @@ class PyBuildExt(build_ext):
133 missing.append('_curses') 136 missing.append('_curses')
134  137
135 # If the curses module is enabled, check for the panel module 138 # If the curses module is enabled, check for the panel module
136- if (module_enabled(exts, '_curses') and 139- if (module_enabled(exts, '_curses') and
137- self.compiler.find_library_file(lib_dirs, panel_library)): 140- self.compiler.find_library_file(lib_dirs, panel_library)):
138+ if (module_enabled(exts, '_curses')): 141+ if (module_enabled(exts, '_curses')):
139 exts.append( Extension('_curses_panel', ['_curses_panel.c'], 142 exts.append( Extension('_curses_panel', ['_curses_panel.c'],
140 include_dirs=curses_includes, 143 include_dirs=curses_includes,
141 define_macros=curses_defines, 144 define_macros=curses_defines,
142@@ -1670,6 +1702,8 @@ class PyBuildExt(build_ext): 145@@ -1670,6 +1705,8 @@ class PyBuildExt(build_ext):
143  146
144 # Build the _uuid module if possible 147 # Build the _uuid module if possible
145 uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"]) 148 uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"])
146+ if uuid_incs is None: 149+ if uuid_incs is None:
147+ uuid_incs = find_file("uuid/uuid.h", inc_dirs, []) 150+ uuid_incs = find_file("uuid/uuid.h", inc_dirs, [])
148 if uuid_incs is not None: 151 if uuid_incs is not None:
149 if self.compiler.find_library_file(lib_dirs, 'uuid'): 152 if self.compiler.find_library_file(lib_dirs, 'uuid'):
150 uuid_libs = ['uuid'] 153 uuid_libs = ['uuid']
151@@ -1936,43 +1970,15 @@ class PyBuildExt(build_ext): 154@@ -1936,43 +1973,15 @@ class PyBuildExt(build_ext):
152 # *** Uncomment these for TOGL extension only: 155 # *** Uncomment these for TOGL extension only:
153 # -lGL -lGLU -lXext -lXmu \ 156 # -lGL -lGLU -lXext -lXmu \
154  157
155- def configure_ctypes_darwin(self, ext): 158- def configure_ctypes_darwin(self, ext):
156- # Darwin (OS X) uses preconfigured files, in 159- # Darwin (OS X) uses preconfigured files, in
157- # the Modules/_ctypes/libffi_osx directory. 160- # the Modules/_ctypes/libffi_osx directory.
158- srcdir = sysconfig.get_config_var('srcdir') 161- srcdir = sysconfig.get_config_var('srcdir')
159- ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules', 162- ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
160- '_ctypes', 'libffi_osx')) 163- '_ctypes', 'libffi_osx'))
161- sources = [os.path.join(ffi_srcdir, p) 164- sources = [os.path.join(ffi_srcdir, p)
162- for p in ['ffi.c', 165- for p in ['ffi.c',
163- 'x86/darwin64.S', 166- 'x86/darwin64.S',
164- 'x86/x86-darwin.S', 167- 'x86/x86-darwin.S',
@@ -187,40 +190,40 @@ https://github.com/python/cpython/pull/2 @@ -187,40 +190,40 @@ https://github.com/python/cpython/pull/2
187- return False 190- return False
188 return True 191 return True
189  192
190 def detect_ctypes(self, inc_dirs, lib_dirs): 193 def detect_ctypes(self, inc_dirs, lib_dirs):
191- self.use_system_libffi = False 194- self.use_system_libffi = False
192+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and host_platform == 'darwin'): 195+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and host_platform == 'darwin'):
193+ self.use_system_libffi = True 196+ self.use_system_libffi = True
194+ else: 197+ else:
195+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS") 198+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
196+ 199+
197 include_dirs = [] 200 include_dirs = []
198 extra_compile_args = [] 201 extra_compile_args = []
199 extra_link_args = [] 202 extra_link_args = []
200@@ -1985,11 +1991,9 @@ class PyBuildExt(build_ext): 203@@ -1985,11 +1994,9 @@ class PyBuildExt(build_ext):
201  204
202 if host_platform == 'darwin': 205 if host_platform == 'darwin':
203 sources.append('_ctypes/malloc_closure.c') 206 sources.append('_ctypes/malloc_closure.c')
204- sources.append('_ctypes/darwin/dlfcn_simple.c') 207- sources.append('_ctypes/darwin/dlfcn_simple.c')
205+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1') 208+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1')
206 extra_compile_args.append('-DMACOSX') 209 extra_compile_args.append('-DMACOSX')
207 include_dirs.append('_ctypes/darwin') 210 include_dirs.append('_ctypes/darwin')
208-# XXX Is this still needed? 211-# XXX Is this still needed?
209-## extra_link_args.extend(['-read_only_relocs', 'warning']) 212-## extra_link_args.extend(['-read_only_relocs', 'warning'])
210  213
211 elif host_platform == 'sunos5': 214 elif host_platform == 'sunos5':
212 # XXX This shouldn't be necessary; it appears that some 215 # XXX This shouldn't be necessary; it appears that some
213@@ -2018,30 +2022,48 @@ class PyBuildExt(build_ext): 216@@ -2018,30 +2025,48 @@ class PyBuildExt(build_ext):
214 libraries=['m']) 217 libraries=['m'])
215 self.extensions.extend([ext, ext_test]) 218 self.extensions.extend([ext, ext_test])
216  219
217+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR") 220+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
218+ ffi_lib = None 221+ ffi_lib = None
219+ 222+
220+ ffi_inc_dirs = inc_dirs.copy() 223+ ffi_inc_dirs = inc_dirs.copy()
221 if host_platform == 'darwin': 224 if host_platform == 'darwin':
222- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"): 225- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
223- return 226- return
224- # OS X 10.5 comes with libffi.dylib; the include files are 227- # OS X 10.5 comes with libffi.dylib; the include files are
225- # in /usr/include/ffi 228- # in /usr/include/ffi
226- inc_dirs.append('/usr/include/ffi') 229- inc_dirs.append('/usr/include/ffi')
@@ -263,34 +266,34 @@ https://github.com/python/cpython/pull/2 @@ -263,34 +266,34 @@ https://github.com/python/cpython/pull/2
263- ext.include_dirs.extend(ffi_inc) 266- ext.include_dirs.extend(ffi_inc)
264+ ffi_headers = glob(os.path.join(ffi_inc, '*.h')) 267+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
265+ if grep_headers_for('ffi_prep_cif_var', ffi_headers): 268+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
266+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1") 269+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
267+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers): 270+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers):
268+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1") 271+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1")
269+ if grep_headers_for('ffi_closure_alloc', ffi_headers): 272+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
270+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1") 273+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1")
271+ 274+
272+ ext.include_dirs.append(ffi_inc) 275+ ext.include_dirs.append(ffi_inc)
273 ext.libraries.append(ffi_lib) 276 ext.libraries.append(ffi_lib)
274 self.use_system_libffi = True 277 self.use_system_libffi = True
275  278
276@@ -2059,10 +2081,7 @@ class PyBuildExt(build_ext): 279@@ -2059,10 +2084,7 @@ class PyBuildExt(build_ext):
277 depends = ['_decimal/docstrings.h'] 280 depends = ['_decimal/docstrings.h']
278 else: 281 else:
279 srcdir = sysconfig.get_config_var('srcdir') 282 srcdir = sysconfig.get_config_var('srcdir')
280- include_dirs = [os.path.abspath(os.path.join(srcdir, 283- include_dirs = [os.path.abspath(os.path.join(srcdir,
281- 'Modules', 284- 'Modules',
282- '_decimal', 285- '_decimal',
283- 'libmpdec'))] 286- 'libmpdec'))]
284+ include_dirs = ['Modules/_decimal/libmpdec'] 287+ include_dirs = ['Modules/_decimal/libmpdec']
285 libraries = ['m'] 288 libraries = ['m']
286 sources = [ 289 sources = [
287 '_decimal/_decimal.c', 290 '_decimal/_decimal.c',
288@@ -2398,7 +2417,7 @@ def main(): 291@@ -2398,7 +2420,7 @@ def main():
289 # If you change the scripts installed here, you also need to 292 # If you change the scripts installed here, you also need to
290 # check the PyBuildScripts command above, and change the links 293 # check the PyBuildScripts command above, and change the links
291 # created by the bininstall target in Makefile.pre.in 294 # created by the bininstall target in Makefile.pre.in
292- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", 295- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
293+ scripts = ["Tools/scripts/pydoc3", 296+ scripts = ["Tools/scripts/pydoc3",
294 "Tools/scripts/2to3", "Tools/scripts/pyvenv"] 297 "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
295 ) 298 )
296  299

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

--- pkgsrc/lang/python38/distinfo 2020/11/18 10:51:01 1.14
+++ pkgsrc/lang/python38/distinfo 2020/11/19 16:29:42 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.14 2020/11/18 10:51:01 sjmulder Exp $ 1$NetBSD: distinfo,v 1.15 2020/11/19 16:29:42 bsiegert 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
@@ -28,14 +28,14 @@ SHA1 (patch-Modules___decimal_libmpdec_m @@ -28,14 +28,14 @@ SHA1 (patch-Modules___decimal_libmpdec_m
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) = 10dc2769432bbfd4360f90fedfa6504d8b6f6347 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) = f5cd4ec25c8a5725a39970a097ddfb7068370db8

cvs diff -r1.4 -r1.5 pkgsrc/lang/python38/patches/patch-setup.py (expand / switch to unified diff)

--- pkgsrc/lang/python38/patches/patch-setup.py 2020/11/17 19:33:15 1.4
+++ pkgsrc/lang/python38/patches/patch-setup.py 2020/11/19 16:29:42 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-setup.py,v 1.4 2020/11/17 19:33:15 sjmulder Exp $ 1$NetBSD: patch-setup.py,v 1.5 2020/11/19 16:29:42 bsiegert Exp $
2 2
3 - Disable certain modules, so they can be built as separate packages. 3 - Disable certain modules, so they can be built as separate packages.
4 - Do not look for ncursesw. 4 - Do not look for ncursesw.
5 - Assume panel_library is correct; this is a fix for ncurses' gnupanel 5 - Assume panel_library is correct; this is a fix for ncurses' gnupanel
6 which will get transformed to panel in buildlink. 6 which will get transformed to panel in buildlink.
7 - Also look for uuid/uuid.h. 7 - Also look for uuid/uuid.h.
8 - Support for macOS 11 and Apple Silicon (ARM). Mostly backported from: 8 - Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
9 https://github.com/python/cpython/pull/22855 9 https://github.com/python/cpython/pull/22855
10 10
11--- setup.py.orig 2020-09-23 12:36:32.000000000 +0000 11--- setup.py.orig 2020-09-23 12:36:32.000000000 +0000
12+++ setup.py 12+++ setup.py
13@@ -10,7 +10,7 @@ import sys 13@@ -10,7 +10,7 @@ import sys
14 import sysconfig 14 import sysconfig
@@ -18,95 +18,98 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17 @@ -18,95 +18,98 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17
18+from distutils import log, text_file 18+from distutils import log, text_file
19 from distutils.command.build_ext import build_ext 19 from distutils.command.build_ext import build_ext
20 from distutils.command.build_scripts import build_scripts 20 from distutils.command.build_scripts import build_scripts
21 from distutils.command.install import install 21 from distutils.command.install import install
22@@ -24,7 +24,7 @@ from distutils.spawn import find_executa 22@@ -24,7 +24,7 @@ from distutils.spawn import find_executa
23 TEST_EXTENSIONS = True 23 TEST_EXTENSIONS = True
24  24
25 # This global variable is used to hold the list of modules to be disabled. 25 # This global variable is used to hold the list of modules to be disabled.
26-DISABLED_MODULE_LIST = [] 26-DISABLED_MODULE_LIST = []
27+DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"] 27+DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
28  28
29  29
30 def get_platform(): 30 def get_platform():
31@@ -188,6 +188,13 @@ def is_macosx_sdk_path(path): 31@@ -188,6 +188,16 @@ def is_macosx_sdk_path(path):
32 or path.startswith('/Library/') ) 32 or path.startswith('/Library/') )
33  33
34  34
35+def grep_headers_for(function, headers): 35+def grep_headers_for(function, headers):
36+ for header in headers: 36+ for header in headers:
37+ with open(header, 'r') as f: 37+ try:
38+ if function in f.read(): 38+ with open(header, 'r') as f:
39+ return True 39+ if function in f.read():
 40+ return True
 41+ except UnicodeDecodeError:
 42+ pass
40+ return False 43+ return False
41+ 44+
42 def find_file(filename, std_dirs, paths): 45 def find_file(filename, std_dirs, paths):
43 """Searches for the directory where a given file is located, 46 """Searches for the directory where a given file is located,
44 and returns a possibly-empty list of additional directories, or None 47 and returns a possibly-empty list of additional directories, or None
45@@ -645,15 +652,15 @@ class PyBuildExt(build_ext): 48@@ -645,15 +655,15 @@ class PyBuildExt(build_ext):
46 add_dir_to_list(dir_list, directory) 49 add_dir_to_list(dir_list, directory)
47  50
48 def configure_compiler(self): 51 def configure_compiler(self):
49- # Ensure that /usr/local is always used, but the local build 52- # Ensure that /usr/local is always used, but the local build
50- # directories (i.e. '.' and 'Include') must be first. See issue 53- # directories (i.e. '.' and 'Include') must be first. See issue
51- # 10520. 54- # 10520.
52- if not CROSS_COMPILING: 55- if not CROSS_COMPILING:
53- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 56- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
54- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 57- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
55- # only change this for cross builds for 3.3, issues on Mageia 58- # only change this for cross builds for 3.3, issues on Mageia
56- if CROSS_COMPILING: 59- if CROSS_COMPILING:
57- self.add_cross_compiling_paths() 60- self.add_cross_compiling_paths()
58+ # Add the buildlink directories for pkgsrc 61+ # Add the buildlink directories for pkgsrc
59+ if os.environ.get('BUILDLINK_DIR'): 62+ if os.environ.get('BUILDLINK_DIR'):
60+ dir = os.environ['BUILDLINK_DIR'] 63+ dir = os.environ['BUILDLINK_DIR']
61+ libdir = dir + '/lib' 64+ libdir = dir + '/lib'
62+ incdir = dir + '/include' 65+ incdir = dir + '/include'
63+ if libdir not in self.compiler.library_dirs: 66+ if libdir not in self.compiler.library_dirs:
64+ self.compiler.library_dirs.insert(0, libdir) 67+ self.compiler.library_dirs.insert(0, libdir)
65+ if incdir not in self.compiler.include_dirs: 68+ if incdir not in self.compiler.include_dirs:
66+ self.compiler.include_dirs.insert(0, incdir) 69+ self.compiler.include_dirs.insert(0, incdir)
67 self.add_multiarch_paths() 70 self.add_multiarch_paths()
68 self.add_ldflags_cppflags() 71 self.add_ldflags_cppflags()
69  72
70@@ -701,6 +708,9 @@ class PyBuildExt(build_ext): 73@@ -701,6 +711,9 @@ class PyBuildExt(build_ext):
71 self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] 74 self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
72  75
73 if MACOS: 76 if MACOS:
74+ self.inc_dirs.append(macosx_sdk_root() + '/usr/include') 77+ self.inc_dirs.append(macosx_sdk_root() + '/usr/include')
75+ self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') 78+ self.lib_dirs.append(macosx_sdk_root() + '/usr/lib')
76+ 79+
77 # This should work on any unixy platform ;-) 80 # This should work on any unixy platform ;-)
78 # If the user has bothered specifying additional -I and -L flags 81 # If the user has bothered specifying additional -I and -L flags
79 # in OPT and LDFLAGS we might as well use them here. 82 # in OPT and LDFLAGS we might as well use them here.
80@@ -912,8 +922,6 @@ class PyBuildExt(build_ext): 83@@ -912,8 +925,6 @@ class PyBuildExt(build_ext):
81 # use the same library for the readline and curses modules. 84 # use the same library for the readline and curses modules.
82 if 'curses' in readline_termcap_library: 85 if 'curses' in readline_termcap_library:
83 curses_library = readline_termcap_library 86 curses_library = readline_termcap_library
84- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): 87- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
85- curses_library = 'ncursesw' 88- curses_library = 'ncursesw'
86 # Issue 36210: OSS provided ncurses does not link on AIX 89 # Issue 36210: OSS provided ncurses does not link on AIX
87 # Use IBM supplied 'curses' for successful build of _curses 90 # Use IBM supplied 'curses' for successful build of _curses
88 elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): 91 elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
89@@ -1015,8 +1023,7 @@ class PyBuildExt(build_ext): 92@@ -1015,8 +1026,7 @@ class PyBuildExt(build_ext):
90 # If the curses module is enabled, check for the panel module 93 # If the curses module is enabled, check for the panel module
91 # _curses_panel needs some form of ncurses 94 # _curses_panel needs some form of ncurses
92 skip_curses_panel = True if AIX else False 95 skip_curses_panel = True if AIX else False
93- if (curses_enabled and not skip_curses_panel and 96- if (curses_enabled and not skip_curses_panel and
94- self.compiler.find_library_file(self.lib_dirs, panel_library)): 97- self.compiler.find_library_file(self.lib_dirs, panel_library)):
95+ if curses_enabled and not skip_curses_panel: 98+ if curses_enabled and not skip_curses_panel:
96 self.add(Extension('_curses_panel', ['_curses_panel.c'], 99 self.add(Extension('_curses_panel', ['_curses_panel.c'],
97 include_dirs=curses_includes, 100 include_dirs=curses_includes,
98 define_macros=curses_defines, 101 define_macros=curses_defines,
99@@ -1263,6 +1270,31 @@ class PyBuildExt(build_ext): 102@@ -1263,6 +1273,31 @@ class PyBuildExt(build_ext):
100 dbm_order = ['gdbm'] 103 dbm_order = ['gdbm']
101 # The standard Unix dbm module: 104 # The standard Unix dbm module:
102 if not CYGWIN: 105 if not CYGWIN:
103+ # Top half based on find_file 106+ # Top half based on find_file
104+ def find_ndbm_h(dirs): 107+ def find_ndbm_h(dirs):
105+ ret = None 108+ ret = None
106+ if MACOS: 109+ if MACOS:
107+ sysroot = macosx_sdk_root() 110+ sysroot = macosx_sdk_root()
108+ for dir in dirs: 111+ for dir in dirs:
109+ f = os.path.join(dir, 'ndbm.h') 112+ f = os.path.join(dir, 'ndbm.h')
110+ if MACOS and is_macosx_sdk_path(dir): 113+ if MACOS and is_macosx_sdk_path(dir):
111+ f = os.path.join(sysroot, dir[1:], 'ndbm.h') 114+ f = os.path.join(sysroot, dir[1:], 'ndbm.h')
112+ if not os.path.exists(f): 115+ if not os.path.exists(f):
@@ -118,45 +121,45 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17 @@ -118,45 +121,45 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17
118+ line = input.readline() 121+ line = input.readline()
119+ if not line: 122+ if not line:
120+ break 123+ break
121+ if re.search('This file is part of GDBM', line): 124+ if re.search('This file is part of GDBM', line):
122+ ret = None 125+ ret = None
123+ break 126+ break
124+ input.close() 127+ input.close()
125+ break 128+ break
126+ return ret 129+ return ret
127+ 130+
128 config_args = [arg.strip("'") 131 config_args = [arg.strip("'")
129 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] 132 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
130 dbm_args = [arg for arg in config_args 133 dbm_args = [arg for arg in config_args
131@@ -1274,7 +1306,7 @@ class PyBuildExt(build_ext): 134@@ -1274,7 +1309,7 @@ class PyBuildExt(build_ext):
132 dbmext = None 135 dbmext = None
133 for cand in dbm_order: 136 for cand in dbm_order:
134 if cand == "ndbm": 137 if cand == "ndbm":
135- if find_file("ndbm.h", self.inc_dirs, []) is not None: 138- if find_file("ndbm.h", self.inc_dirs, []) is not None:
136+ if find_ndbm_h(self.inc_dirs) is not None: 139+ if find_ndbm_h(self.inc_dirs) is not None:
137 # Some systems have -lndbm, others have -lgdbm_compat, 140 # Some systems have -lndbm, others have -lgdbm_compat,
138 # others don't have either 141 # others don't have either
139 if self.compiler.find_library_file(self.lib_dirs, 142 if self.compiler.find_library_file(self.lib_dirs,
140@@ -1674,6 +1706,8 @@ class PyBuildExt(build_ext): 143@@ -1674,6 +1709,8 @@ class PyBuildExt(build_ext):
141 def detect_uuid(self): 144 def detect_uuid(self):
142 # Build the _uuid module if possible 145 # Build the _uuid module if possible
143 uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"]) 146 uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
144+ if uuid_incs is None: 147+ if uuid_incs is None:
145+ uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, []) 148+ uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, [])
146 if uuid_incs is not None: 149 if uuid_incs is not None:
147 if self.compiler.find_library_file(self.lib_dirs, 'uuid'): 150 if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
148 uuid_libs = ['uuid'] 151 uuid_libs = ['uuid']
149@@ -1956,43 +1990,17 @@ class PyBuildExt(build_ext): 152@@ -1956,43 +1993,17 @@ class PyBuildExt(build_ext):
150 library_dirs=added_lib_dirs)) 153 library_dirs=added_lib_dirs))
151 return True 154 return True
152  155
153- def configure_ctypes_darwin(self, ext): 156- def configure_ctypes_darwin(self, ext):
154- # Darwin (OS X) uses preconfigured files, in 157- # Darwin (OS X) uses preconfigured files, in
155- # the Modules/_ctypes/libffi_osx directory. 158- # the Modules/_ctypes/libffi_osx directory.
156- ffi_srcdir = os.path.abspath(os.path.join(self.srcdir, 'Modules', 159- ffi_srcdir = os.path.abspath(os.path.join(self.srcdir, 'Modules',
157- '_ctypes', 'libffi_osx')) 160- '_ctypes', 'libffi_osx'))
158- sources = [os.path.join(ffi_srcdir, p) 161- sources = [os.path.join(ffi_srcdir, p)
159- for p in ['ffi.c', 162- for p in ['ffi.c',
160- 'x86/darwin64.S', 163- 'x86/darwin64.S',
161- 'x86/x86-darwin.S', 164- 'x86/x86-darwin.S',
162- 'x86/x86-ffi_darwin.c', 165- 'x86/x86-ffi_darwin.c',
@@ -186,40 +189,40 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17 @@ -186,40 +189,40 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17
186  189
187 def detect_ctypes(self): 190 def detect_ctypes(self):
188 # Thomas Heller's _ctypes module 191 # Thomas Heller's _ctypes module
189- self.use_system_libffi = False 192- self.use_system_libffi = False
190+ 193+
191+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and MACOS): 194+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and MACOS):
192+ self.use_system_libffi = True 195+ self.use_system_libffi = True
193+ else: 196+ else:
194+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS") 197+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
195+ 198+
196 include_dirs = [] 199 include_dirs = []
197 extra_compile_args = [] 200 extra_compile_args = []
198 extra_link_args = [] 201 extra_link_args = []
199@@ -2005,11 +2013,9 @@ class PyBuildExt(build_ext): 202@@ -2005,11 +2016,9 @@ class PyBuildExt(build_ext):
200  203
201 if MACOS: 204 if MACOS:
202 sources.append('_ctypes/malloc_closure.c') 205 sources.append('_ctypes/malloc_closure.c')
203- sources.append('_ctypes/darwin/dlfcn_simple.c') 206- sources.append('_ctypes/darwin/dlfcn_simple.c')
204+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1') 207+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1')
205 extra_compile_args.append('-DMACOSX') 208 extra_compile_args.append('-DMACOSX')
206 include_dirs.append('_ctypes/darwin') 209 include_dirs.append('_ctypes/darwin')
207- # XXX Is this still needed? 210- # XXX Is this still needed?
208- # extra_link_args.extend(['-read_only_relocs', 'warning']) 211- # extra_link_args.extend(['-read_only_relocs', 'warning'])
209  212
210 elif HOST_PLATFORM == 'sunos5': 213 elif HOST_PLATFORM == 'sunos5':
211 # XXX This shouldn't be necessary; it appears that some 214 # XXX This shouldn't be necessary; it appears that some
212@@ -2039,31 +2045,48 @@ class PyBuildExt(build_ext): 215@@ -2039,31 +2048,48 @@ class PyBuildExt(build_ext):
213 sources=['_ctypes/_ctypes_test.c'], 216 sources=['_ctypes/_ctypes_test.c'],
214 libraries=['m'])) 217 libraries=['m']))
215  218
216+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR") 219+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
217+ ffi_lib = None 220+ ffi_lib = None
218+ 221+
219 ffi_inc_dirs = self.inc_dirs.copy() 222 ffi_inc_dirs = self.inc_dirs.copy()
220 if MACOS: 223 if MACOS:
221- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"): 224- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
222- return 225- return
223- # OS X 10.5 comes with libffi.dylib; the include files are 226- # OS X 10.5 comes with libffi.dylib; the include files are
224- # in /usr/include/ffi 227- # in /usr/include/ffi
225- ffi_inc_dirs.append('/usr/include/ffi') 228- ffi_inc_dirs.append('/usr/include/ffi')
@@ -262,34 +265,34 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17 @@ -262,34 +265,34 @@ $NetBSD: patch-setup.py,v 1.4 2020/11/17
262- ext.include_dirs.extend(ffi_inc) 265- ext.include_dirs.extend(ffi_inc)
263+ ffi_headers = glob(os.path.join(ffi_inc, '*.h')) 266+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
264+ if grep_headers_for('ffi_prep_cif_var', ffi_headers): 267+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
265+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1") 268+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
266+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers): 269+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers):
267+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1") 270+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1")
268+ if grep_headers_for('ffi_closure_alloc', ffi_headers): 271+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
269+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1") 272+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1")
270+ 273+
271+ ext.include_dirs.append(ffi_inc) 274+ ext.include_dirs.append(ffi_inc)
272 ext.libraries.append(ffi_lib) 275 ext.libraries.append(ffi_lib)
273 self.use_system_libffi = True 276 self.use_system_libffi = True
274  277
275@@ -2081,10 +2104,7 @@ class PyBuildExt(build_ext): 278@@ -2081,10 +2107,7 @@ class PyBuildExt(build_ext):
276 sources = ['_decimal/_decimal.c'] 279 sources = ['_decimal/_decimal.c']
277 depends = ['_decimal/docstrings.h'] 280 depends = ['_decimal/docstrings.h']
278 else: 281 else:
279- include_dirs = [os.path.abspath(os.path.join(self.srcdir, 282- include_dirs = [os.path.abspath(os.path.join(self.srcdir,
280- 'Modules', 283- 'Modules',
281- '_decimal', 284- '_decimal',
282- 'libmpdec'))] 285- 'libmpdec'))]
283+ include_dirs = ['Modules/_decimal/libmpdec'] 286+ include_dirs = ['Modules/_decimal/libmpdec']
284 libraries = ['m'] 287 libraries = ['m']
285 sources = [ 288 sources = [
286 '_decimal/_decimal.c', 289 '_decimal/_decimal.c',
287@@ -2424,7 +2444,7 @@ def main(): 290@@ -2424,7 +2447,7 @@ def main():
288 # If you change the scripts installed here, you also need to 291 # If you change the scripts installed here, you also need to
289 # check the PyBuildScripts command above, and change the links 292 # check the PyBuildScripts command above, and change the links
290 # created by the bininstall target in Makefile.pre.in 293 # created by the bininstall target in Makefile.pre.in
291- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", 294- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
292+ scripts = ["Tools/scripts/pydoc3", 295+ scripts = ["Tools/scripts/pydoc3",
293 "Tools/scripts/2to3"] 296 "Tools/scripts/2to3"]
294 ) 297 )
295  298

cvs diff -r1.3 -r1.4 pkgsrc/lang/python39/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/python39/distinfo 2020/11/18 12:18:29 1.3
+++ pkgsrc/lang/python39/distinfo 2020/11/19 16:29:42 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.3 2020/11/18 12:18:29 sjmulder Exp $ 1$NetBSD: distinfo,v 1.4 2020/11/19 16:29:42 bsiegert Exp $
2 2
3SHA1 (Python-3.9.0.tar.xz) = ff1fc8c37d5d4b09ec3bf0d84f3e5b97745c6704 3SHA1 (Python-3.9.0.tar.xz) = ff1fc8c37d5d4b09ec3bf0d84f3e5b97745c6704
4RMD160 (Python-3.9.0.tar.xz) = 822fd1ea11f3ca303a08317f6db61f2a1e03e5ef 4RMD160 (Python-3.9.0.tar.xz) = 822fd1ea11f3ca303a08317f6db61f2a1e03e5ef
5SHA512 (Python-3.9.0.tar.xz) = b141039c9701a8cb0d15cd11a279153077524af4d0599e7d2c7279d4c18d05fda06b33ef82342d875de996c7117b7dc6eb154dc3669d38a1efa99801aeec6c5e 5SHA512 (Python-3.9.0.tar.xz) = b141039c9701a8cb0d15cd11a279153077524af4d0599e7d2c7279d4c18d05fda06b33ef82342d875de996c7117b7dc6eb154dc3669d38a1efa99801aeec6c5e
6Size (Python-3.9.0.tar.xz) = 18866140 bytes 6Size (Python-3.9.0.tar.xz) = 18866140 bytes
7SHA1 (patch-Lib___osx__support.py) = 4ccccb81381cd7bf4a8bbc3e376d1234cf2266d5 7SHA1 (patch-Lib___osx__support.py) = 4ccccb81381cd7bf4a8bbc3e376d1234cf2266d5
8SHA1 (patch-Lib_ctypes_macholib_dyld.py) = d7f3e0c63d6926db253fbe923dd97995478d528c 8SHA1 (patch-Lib_ctypes_macholib_dyld.py) = d7f3e0c63d6926db253fbe923dd97995478d528c
9SHA1 (patch-Lib_ctypes_test_test__macholib.py) = bd887357759975b7a497c4079bc730e9c578ceed 9SHA1 (patch-Lib_ctypes_test_test__macholib.py) = bd887357759975b7a497c4079bc730e9c578ceed
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) = 145a0f01b3602c582e033081a35d4d86245575f9 13SHA1 (patch-Lib_distutils_tests_test__build__ext.py) = 145a0f01b3602c582e033081a35d4d86245575f9
14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 14SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69
@@ -29,14 +29,14 @@ SHA1 (patch-Modules___zoneinfo.c) = b1df @@ -29,14 +29,14 @@ SHA1 (patch-Modules___zoneinfo.c) = b1df
29SHA1 (patch-Modules_getpath.c) = d7114d21d7d9c7167fad259b115cb02e4153c531 29SHA1 (patch-Modules_getpath.c) = d7114d21d7d9c7167fad259b115cb02e4153c531
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) = c592ef4ebe650f672a15ff9887cbeed2ca73b666 32SHA1 (patch-Modules_posixmodule.c) = c592ef4ebe650f672a15ff9887cbeed2ca73b666
33SHA1 (patch-Modules_socketmodule.c) = 02c447f980a08e2185df78d2f13373574f414304 33SHA1 (patch-Modules_socketmodule.c) = 02c447f980a08e2185df78d2f13373574f414304
34SHA1 (patch-Modules_socketmodule.h) = 61fe96a79d4ccf3e7768eb79dd7e29a50a85328b 34SHA1 (patch-Modules_socketmodule.h) = 61fe96a79d4ccf3e7768eb79dd7e29a50a85328b
35SHA1 (patch-Modules_timemodule.c) = 8c8e9e43b6d165c1a7df6142a6bcd430003ed165 35SHA1 (patch-Modules_timemodule.c) = 8c8e9e43b6d165c1a7df6142a6bcd430003ed165
36SHA1 (patch-Python_bootstrap__hash.c) = cbc2839675182a344591ba672187b166f166499b 36SHA1 (patch-Python_bootstrap__hash.c) = cbc2839675182a344591ba672187b166f166499b
37SHA1 (patch-Python_pytime.c) = 1bb39b7060c1f337562208dc6611672eaf2f586b 37SHA1 (patch-Python_pytime.c) = 1bb39b7060c1f337562208dc6611672eaf2f586b
38SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be 38SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
39SHA1 (patch-configure) = 371a65a2cb10fe7709d30a16358b48bc2e0a4aa6 39SHA1 (patch-configure) = 371a65a2cb10fe7709d30a16358b48bc2e0a4aa6
40SHA1 (patch-configure.ac) = 4ce75ef922e015adf095cb481c829b11c0454efe 40SHA1 (patch-configure.ac) = 4ce75ef922e015adf095cb481c829b11c0454efe
41SHA1 (patch-pyconfig.h.in) = 7c1c997c089f882fbd334b81c04a03dbaebb2c41 41SHA1 (patch-pyconfig.h.in) = 7c1c997c089f882fbd334b81c04a03dbaebb2c41
42SHA1 (patch-setup.py) = a9e467f8aed7085a982af6a1273b883550d06610 42SHA1 (patch-setup.py) = ab1a7cb97fb8718d21f07f8c896b7de660189c67

cvs diff -r1.2 -r1.3 pkgsrc/lang/python39/patches/patch-setup.py (expand / switch to unified diff)

--- pkgsrc/lang/python39/patches/patch-setup.py 2020/11/12 10:58:21 1.2
+++ pkgsrc/lang/python39/patches/patch-setup.py 2020/11/19 16:29:42 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-setup.py,v 1.2 2020/11/12 10:58:21 sjmulder Exp $ 1$NetBSD: patch-setup.py,v 1.3 2020/11/19 16:29:42 bsiegert Exp $
2 2
3 - Disable certain modules, so they can be built as separate packages. 3 - Disable certain modules, so they can be built as separate packages.
4 - Do not look for ncursesw. 4 - Do not look for ncursesw.
5 - Assume panel_library is correct; this is a fix for ncurses' gnupanel 5 - Assume panel_library is correct; this is a fix for ncurses' gnupanel
6 which will get transformed to panel in buildlink. 6 which will get transformed to panel in buildlink.
7 - Also look for uuid/uuid.h. 7 - Also look for uuid/uuid.h.
8 - Support for macOS 11 and Apple Silicon (ARM). Backported from: 8 - Support for macOS 11 and Apple Silicon (ARM). Backported from:
9 https://github.com/python/cpython/pull/22855 9 https://github.com/python/cpython/pull/22855
10 10
11--- setup.py.orig 2020-10-05 15:07:58.000000000 +0000 11--- setup.py.orig 2020-10-05 15:07:58.000000000 +0000
12+++ setup.py 12+++ setup.py
13@@ -29,7 +29,7 @@ except ImportError: 13@@ -29,7 +29,7 @@ except ImportError:
14 SUBPROCESS_BOOTSTRAP = True 14 SUBPROCESS_BOOTSTRAP = True
@@ -18,95 +18,98 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12 @@ -18,95 +18,98 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12
18+from distutils import log, text_file 18+from distutils import log, text_file
19 from distutils.command.build_ext import build_ext 19 from distutils.command.build_ext import build_ext
20 from distutils.command.build_scripts import build_scripts 20 from distutils.command.build_scripts import build_scripts
21 from distutils.command.install import install 21 from distutils.command.install import install
22@@ -43,7 +43,7 @@ from distutils.spawn import find_executa 22@@ -43,7 +43,7 @@ from distutils.spawn import find_executa
23 TEST_EXTENSIONS = True 23 TEST_EXTENSIONS = True
24  24
25 # This global variable is used to hold the list of modules to be disabled. 25 # This global variable is used to hold the list of modules to be disabled.
26-DISABLED_MODULE_LIST = [] 26-DISABLED_MODULE_LIST = []
27+DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"] 27+DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
28  28
29  29
30 def get_platform(): 30 def get_platform():
31@@ -239,6 +239,13 @@ def is_macosx_sdk_path(path): 31@@ -239,6 +239,16 @@ def is_macosx_sdk_path(path):
32 or path.startswith('/Library/') ) 32 or path.startswith('/Library/') )
33  33
34  34
35+def grep_headers_for(function, headers): 35+def grep_headers_for(function, headers):
36+ for header in headers: 36+ for header in headers:
37+ with open(header, 'r') as f: 37+ try:
38+ if function in f.read(): 38+ with open(header, 'r') as f:
39+ return True 39+ if function in f.read():
 40+ return True
 41+ except UnicodeDecodeError:
 42+ pass
40+ return False 43+ return False
41+ 44+
42 def find_file(filename, std_dirs, paths): 45 def find_file(filename, std_dirs, paths):
43 """Searches for the directory where a given file is located, 46 """Searches for the directory where a given file is located,
44 and returns a possibly-empty list of additional directories, or None 47 and returns a possibly-empty list of additional directories, or None
45@@ -740,15 +740,15 @@ class PyBuildExt(build_ext): 48@@ -740,15 +750,15 @@ class PyBuildExt(build_ext):
46 add_dir_to_list(dir_list, directory) 49 add_dir_to_list(dir_list, directory)
47  50
48 def configure_compiler(self): 51 def configure_compiler(self):
49- # Ensure that /usr/local is always used, but the local build 52- # Ensure that /usr/local is always used, but the local build
50- # directories (i.e. '.' and 'Include') must be first. See issue 53- # directories (i.e. '.' and 'Include') must be first. See issue
51- # 10520. 54- # 10520.
52- if not CROSS_COMPILING: 55- if not CROSS_COMPILING:
53- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') 56- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
54- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 57- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
55- # only change this for cross builds for 3.3, issues on Mageia 58- # only change this for cross builds for 3.3, issues on Mageia
56- if CROSS_COMPILING: 59- if CROSS_COMPILING:
57- self.add_cross_compiling_paths() 60- self.add_cross_compiling_paths()
58+ # Add the buildlink directories for pkgsrc 61+ # Add the buildlink directories for pkgsrc
59+ if os.environ.get('BUILDLINK_DIR'): 62+ if os.environ.get('BUILDLINK_DIR'):
60+ dir = os.environ['BUILDLINK_DIR'] 63+ dir = os.environ['BUILDLINK_DIR']
61+ libdir = dir + '/lib' 64+ libdir = dir + '/lib'
62+ incdir = dir + '/include' 65+ incdir = dir + '/include'
63+ if libdir not in self.compiler.library_dirs: 66+ if libdir not in self.compiler.library_dirs:
64+ self.compiler.library_dirs.insert(0, libdir) 67+ self.compiler.library_dirs.insert(0, libdir)
65+ if incdir not in self.compiler.include_dirs: 68+ if incdir not in self.compiler.include_dirs:
66+ self.compiler.include_dirs.insert(0, incdir) 69+ self.compiler.include_dirs.insert(0, incdir)
67 self.add_multiarch_paths() 70 self.add_multiarch_paths()
68 self.add_ldflags_cppflags() 71 self.add_ldflags_cppflags()
69  72
70@@ -803,6 +803,9 @@ class PyBuildExt(build_ext): 73@@ -796,6 +806,9 @@ class PyBuildExt(build_ext):
71 self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] 74 self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
72  75
73 if MACOS: 76 if MACOS:
74+ self.inc_dirs.append(macosx_sdk_root() + '/usr/include') 77+ self.inc_dirs.append(macosx_sdk_root() + '/usr/include')
75+ self.lib_dirs.append(macosx_sdk_root() + '/usr/lib') 78+ self.lib_dirs.append(macosx_sdk_root() + '/usr/lib')
76+ 79+
77 # This should work on any unixy platform ;-) 80 # This should work on any unixy platform ;-)
78 # If the user has bothered specifying additional -I and -L flags 81 # If the user has bothered specifying additional -I and -L flags
79 # in OPT and LDFLAGS we might as well use them here. 82 # in OPT and LDFLAGS we might as well use them here.
80@@ -1013,8 +1013,6 @@ class PyBuildExt(build_ext): 83@@ -1013,8 +1026,6 @@ class PyBuildExt(build_ext):
81 # use the same library for the readline and curses modules. 84 # use the same library for the readline and curses modules.
82 if 'curses' in readline_termcap_library: 85 if 'curses' in readline_termcap_library:
83 curses_library = readline_termcap_library 86 curses_library = readline_termcap_library
84- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): 87- elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
85- curses_library = 'ncursesw' 88- curses_library = 'ncursesw'
86 # Issue 36210: OSS provided ncurses does not link on AIX 89 # Issue 36210: OSS provided ncurses does not link on AIX
87 # Use IBM supplied 'curses' for successful build of _curses 90 # Use IBM supplied 'curses' for successful build of _curses
88 elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): 91 elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
89@@ -1116,8 +1114,7 @@ class PyBuildExt(build_ext): 92@@ -1116,8 +1127,7 @@ class PyBuildExt(build_ext):
90 # If the curses module is enabled, check for the panel module 93 # If the curses module is enabled, check for the panel module
91 # _curses_panel needs some form of ncurses 94 # _curses_panel needs some form of ncurses
92 skip_curses_panel = True if AIX else False 95 skip_curses_panel = True if AIX else False
93- if (curses_enabled and not skip_curses_panel and 96- if (curses_enabled and not skip_curses_panel and
94- self.compiler.find_library_file(self.lib_dirs, panel_library)): 97- self.compiler.find_library_file(self.lib_dirs, panel_library)):
95+ if curses_enabled and not skip_curses_panel: 98+ if curses_enabled and not skip_curses_panel:
96 self.add(Extension('_curses_panel', ['_curses_panel.c'], 99 self.add(Extension('_curses_panel', ['_curses_panel.c'],
97 include_dirs=curses_includes, 100 include_dirs=curses_includes,
98 define_macros=curses_defines, 101 define_macros=curses_defines,
99@@ -1368,6 +1365,31 @@ class PyBuildExt(build_ext): 102@@ -1368,6 +1378,31 @@ class PyBuildExt(build_ext):
100 dbm_order = ['gdbm'] 103 dbm_order = ['gdbm']
101 # The standard Unix dbm module: 104 # The standard Unix dbm module:
102 if not CYGWIN: 105 if not CYGWIN:
103+ # Top half based on find_file 106+ # Top half based on find_file
104+ def find_ndbm_h(dirs): 107+ def find_ndbm_h(dirs):
105+ ret = None 108+ ret = None
106+ if MACOS: 109+ if MACOS:
107+ sysroot = macosx_sdk_root() 110+ sysroot = macosx_sdk_root()
108+ for dir in dirs: 111+ for dir in dirs:
109+ f = os.path.join(dir, 'ndbm.h') 112+ f = os.path.join(dir, 'ndbm.h')
110+ if MACOS and is_macosx_sdk_path(dir): 113+ if MACOS and is_macosx_sdk_path(dir):
111+ f = os.path.join(sysroot, dir[1:], 'ndbm.h') 114+ f = os.path.join(sysroot, dir[1:], 'ndbm.h')
112+ if not os.path.exists(f): 115+ if not os.path.exists(f):
@@ -118,45 +121,45 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12 @@ -118,45 +121,45 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12
118+ line = input.readline() 121+ line = input.readline()
119+ if not line: 122+ if not line:
120+ break 123+ break
121+ if re.search('This file is part of GDBM', line): 124+ if re.search('This file is part of GDBM', line):
122+ ret = None 125+ ret = None
123+ break 126+ break
124+ input.close() 127+ input.close()
125+ break 128+ break
126+ return ret 129+ return ret
127+ 130+
128 config_args = [arg.strip("'") 131 config_args = [arg.strip("'")
129 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] 132 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
130 dbm_args = [arg for arg in config_args 133 dbm_args = [arg for arg in config_args
131@@ -1379,7 +1401,7 @@ class PyBuildExt(build_ext): 134@@ -1379,7 +1414,7 @@ class PyBuildExt(build_ext):
132 dbmext = None 135 dbmext = None
133 for cand in dbm_order: 136 for cand in dbm_order:
134 if cand == "ndbm": 137 if cand == "ndbm":
135- if find_file("ndbm.h", self.inc_dirs, []) is not None: 138- if find_file("ndbm.h", self.inc_dirs, []) is not None:
136+ if find_ndbm_h(self.inc_dirs) is not None: 139+ if find_ndbm_h(self.inc_dirs) is not None:
137 # Some systems have -lndbm, others have -lgdbm_compat, 140 # Some systems have -lndbm, others have -lgdbm_compat,
138 # others don't have either 141 # others don't have either
139 if self.compiler.find_library_file(self.lib_dirs, 142 if self.compiler.find_library_file(self.lib_dirs,
140@@ -1779,6 +1801,8 @@ class PyBuildExt(build_ext): 143@@ -1779,6 +1814,8 @@ class PyBuildExt(build_ext):
141 def detect_uuid(self): 144 def detect_uuid(self):
142 # Build the _uuid module if possible 145 # Build the _uuid module if possible
143 uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"]) 146 uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
144+ if uuid_incs is None: 147+ if uuid_incs is None:
145+ uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, []) 148+ uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, [])
146 if uuid_incs is not None: 149 if uuid_incs is not None:
147 if self.compiler.find_library_file(self.lib_dirs, 'uuid'): 150 if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
148 uuid_libs = ['uuid'] 151 uuid_libs = ['uuid']
149@@ -2101,43 +2108,17 @@ class PyBuildExt(build_ext): 152@@ -2101,43 +2138,17 @@ class PyBuildExt(build_ext):
150 library_dirs=added_lib_dirs)) 153 library_dirs=added_lib_dirs))
151 return True 154 return True
152  155
153- def configure_ctypes_darwin(self, ext): 156- def configure_ctypes_darwin(self, ext):
154- # Darwin (OS X) uses preconfigured files, in 157- # Darwin (OS X) uses preconfigured files, in
155- # the Modules/_ctypes/libffi_osx directory. 158- # the Modules/_ctypes/libffi_osx directory.
156- ffi_srcdir = os.path.abspath(os.path.join(self.srcdir, 'Modules', 159- ffi_srcdir = os.path.abspath(os.path.join(self.srcdir, 'Modules',
157- '_ctypes', 'libffi_osx')) 160- '_ctypes', 'libffi_osx'))
158- sources = [os.path.join(ffi_srcdir, p) 161- sources = [os.path.join(ffi_srcdir, p)
159- for p in ['ffi.c', 162- for p in ['ffi.c',
160- 'x86/darwin64.S', 163- 'x86/darwin64.S',
161- 'x86/x86-darwin.S', 164- 'x86/x86-darwin.S',
162- 'x86/x86-ffi_darwin.c', 165- 'x86/x86-ffi_darwin.c',
@@ -186,40 +189,40 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12 @@ -186,40 +189,40 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12
186  189
187 def detect_ctypes(self): 190 def detect_ctypes(self):
188 # Thomas Heller's _ctypes module 191 # Thomas Heller's _ctypes module
189- self.use_system_libffi = False 192- self.use_system_libffi = False
190+ 193+
191+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and MACOS): 194+ if (not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and MACOS):
192+ self.use_system_libffi = True 195+ self.use_system_libffi = True
193+ else: 196+ else:
194+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS") 197+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
195+ 198+
196 include_dirs = [] 199 include_dirs = []
197 extra_compile_args = ['-DPy_BUILD_CORE_MODULE'] 200 extra_compile_args = ['-DPy_BUILD_CORE_MODULE']
198 extra_link_args = [] 201 extra_link_args = []
199@@ -2150,11 +2131,9 @@ class PyBuildExt(build_ext): 202@@ -2150,11 +2161,9 @@ class PyBuildExt(build_ext):
200  203
201 if MACOS: 204 if MACOS:
202 sources.append('_ctypes/malloc_closure.c') 205 sources.append('_ctypes/malloc_closure.c')
203- sources.append('_ctypes/darwin/dlfcn_simple.c') 206- sources.append('_ctypes/darwin/dlfcn_simple.c')
204+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1') 207+ extra_compile_args.append('-DUSING_MALLOC_CLOSURE_DOT_C=1')
205 extra_compile_args.append('-DMACOSX') 208 extra_compile_args.append('-DMACOSX')
206 include_dirs.append('_ctypes/darwin') 209 include_dirs.append('_ctypes/darwin')
207- # XXX Is this still needed? 210- # XXX Is this still needed?
208- # extra_link_args.extend(['-read_only_relocs', 'warning']) 211- # extra_link_args.extend(['-read_only_relocs', 'warning'])
209  212
210 elif HOST_PLATFORM == 'sunos5': 213 elif HOST_PLATFORM == 'sunos5':
211 # XXX This shouldn't be necessary; it appears that some 214 # XXX This shouldn't be necessary; it appears that some
212@@ -2184,31 +2163,48 @@ class PyBuildExt(build_ext): 215@@ -2184,31 +2193,48 @@ class PyBuildExt(build_ext):
213 sources=['_ctypes/_ctypes_test.c'], 216 sources=['_ctypes/_ctypes_test.c'],
214 libraries=['m'])) 217 libraries=['m']))
215  218
216+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR") 219+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
217+ ffi_lib = None 220+ ffi_lib = None
218+ 221+
219 ffi_inc_dirs = self.inc_dirs.copy() 222 ffi_inc_dirs = self.inc_dirs.copy()
220 if MACOS: 223 if MACOS:
221- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"): 224- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
222- return 225- return
223- # OS X 10.5 comes with libffi.dylib; the include files are 226- # OS X 10.5 comes with libffi.dylib; the include files are
224- # in /usr/include/ffi 227- # in /usr/include/ffi
225- ffi_inc_dirs.append('/usr/include/ffi') 228- ffi_inc_dirs.append('/usr/include/ffi')
@@ -262,34 +265,34 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12 @@ -262,34 +265,34 @@ $NetBSD: patch-setup.py,v 1.2 2020/11/12
262- ext.include_dirs.extend(ffi_inc) 265- ext.include_dirs.extend(ffi_inc)
263+ ffi_headers = glob(os.path.join(ffi_inc, '*.h')) 266+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
264+ if grep_headers_for('ffi_prep_cif_var', ffi_headers): 267+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
265+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1") 268+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
266+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers): 269+ if grep_headers_for('ffi_prep_closure_loc', ffi_headers):
267+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1") 270+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1")
268+ if grep_headers_for('ffi_closure_alloc', ffi_headers): 271+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
269+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1") 272+ ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1")
270+ 273+
271+ ext.include_dirs.append(ffi_inc) 274+ ext.include_dirs.append(ffi_inc)
272 ext.libraries.append(ffi_lib) 275 ext.libraries.append(ffi_lib)
273 self.use_system_libffi = True 276 self.use_system_libffi = True
274  277
275@@ -2226,10 +2250,7 @@ class PyBuildExt(build_ext): 278@@ -2226,10 +2252,7 @@ class PyBuildExt(build_ext):
276 sources = ['_decimal/_decimal.c'] 279 sources = ['_decimal/_decimal.c']
277 depends = ['_decimal/docstrings.h'] 280 depends = ['_decimal/docstrings.h']
278 else: 281 else:
279- include_dirs = [os.path.abspath(os.path.join(self.srcdir, 282- include_dirs = [os.path.abspath(os.path.join(self.srcdir,
280- 'Modules', 283- 'Modules',
281- '_decimal', 284- '_decimal',
282- 'libmpdec'))] 285- 'libmpdec'))]
283+ include_dirs = ['Modules/_decimal/libmpdec'] 286+ include_dirs = ['Modules/_decimal/libmpdec']
284 libraries = ['m'] 287 libraries = ['m']
285 sources = [ 288 sources = [
286 '_decimal/_decimal.c', 289 '_decimal/_decimal.c',
287@@ -2609,7 +2630,7 @@ def main(): 290@@ -2609,7 +2632,7 @@ def main():
288 # If you change the scripts installed here, you also need to 291 # If you change the scripts installed here, you also need to
289 # check the PyBuildScripts command above, and change the links 292 # check the PyBuildScripts command above, and change the links
290 # created by the bininstall target in Makefile.pre.in 293 # created by the bininstall target in Makefile.pre.in
291- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", 294- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
292+ scripts = ["Tools/scripts/pydoc3", 295+ scripts = ["Tools/scripts/pydoc3",
293 "Tools/scripts/2to3"] 296 "Tools/scripts/2to3"]
294 ) 297 )
295  298