python{39,310}: fix the build when the work directory is in $PREFIX As documented in pkg/56774, when WRKOBJDIR is in LOCALBASE (eg set to ${LOCALBASE}/work) then changes done to Python's setup.py made it unable to locate its own built-in modules, then failing to bootstrap and build. As suggested by tnn@; tested on NetBSD/amd64. XXX pull-up to pkgsrc-2022Q2diff -r1.16 -r1.17 pkgsrc/lang/python310/distinfo
(khorben)
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | $NetBSD: distinfo,v 1.16 2022/06/08 17:56:46 adam Exp $ | 1 | $NetBSD: distinfo,v 1.17 2022/07/07 15:26:43 khorben Exp $ | |
2 | 2 | |||
3 | BLAKE2s (Python-3.10.5.tar.xz) = d214998206e2adac9a487633cbb436fbedf31be48e86ef7f391fe6c7854805eb | 3 | BLAKE2s (Python-3.10.5.tar.xz) = d214998206e2adac9a487633cbb436fbedf31be48e86ef7f391fe6c7854805eb | |
4 | SHA512 (Python-3.10.5.tar.xz) = aa7f58a9b31de9824185b3e7bfa7da0dcf64ae9e89840664eae9d98d9048a650fa012cd5b873a62ff44b65b856db86f095c4003117406ec5e9583ec5f7e78e90 | 4 | SHA512 (Python-3.10.5.tar.xz) = aa7f58a9b31de9824185b3e7bfa7da0dcf64ae9e89840664eae9d98d9048a650fa012cd5b873a62ff44b65b856db86f095c4003117406ec5e9583ec5f7e78e90 | |
5 | Size (Python-3.10.5.tar.xz) = 19361320 bytes | 5 | Size (Python-3.10.5.tar.xz) = 19361320 bytes | |
6 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | 6 | SHA1 (patch-Lib_ctypes_util.py) = 3dec1b6b7a36e46cbfa0dfcd71c5e7fac9f60764 | |
7 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | 7 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 8a91e8f4f86517a62408c3a10ed5eb50c4091fbf | |
8 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | 8 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 593c4e93c5653ab400f0a98b91db92630c0a7390 | |
9 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | 9 | SHA1 (patch-Lib_sysconfig.py) = bc6d91bf8f7121456b26ea7f080f588c96f2596f | |
10 | SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a | 10 | SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a | |
11 | SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b | 11 | SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b | |
12 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | 12 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | |
13 | SHA1 (patch-Python_thread__pthread.h) = bf1aeab011b3afedc02e68fcf5cef091b3e0aefa | 13 | SHA1 (patch-Python_thread__pthread.h) = bf1aeab011b3afedc02e68fcf5cef091b3e0aefa | |
14 | SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6 | 14 | SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6 | |
15 | SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6 | 15 | SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6 | |
16 | SHA1 (patch-setup.py) = f71085603ac5d343ee60c1d18f4f4bde0791fa6b | 16 | SHA1 (patch-setup.py) = 0fd4a3eb38b324296e6da91612048f5d2dd10995 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | $NetBSD: patch-setup.py,v 1.5 2022/04/03 10:54:52 riastradh Exp $ | 1 | $NetBSD: patch-setup.py,v 1.6 2022/07/07 15:26:43 khorben 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 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | 7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | |
8 | are installed. | 8 | are installed. | |
9 | Enable cross-build by setting sys._home and sys.path to build directory | 9 | Enable cross-build by setting sys._home and sys.path to build directory | |
10 | 10 | |||
11 | --- setup.py.orig 2022-03-23 20:12:04.000000000 +0000 | 11 | --- setup.py.orig 2022-03-23 20:12:04.000000000 +0000 | |
12 | +++ setup.py | 12 | +++ setup.py | |
13 | @@ -1,5 +1,11 @@ | 13 | @@ -1,5 +1,11 @@ | |
14 | # Autodetecting setup.py script for building the Python extensions | 14 | # Autodetecting setup.py script for building the Python extensions | |
@@ -16,27 +16,27 @@ Enable cross-build by setting sys._home | @@ -16,27 +16,27 @@ Enable cross-build by setting sys._home | |||
16 | +import sys | 16 | +import sys | |
17 | +sys._home = __file__[:-len('/setup.py')] | 17 | +sys._home = __file__[:-len('/setup.py')] | |
18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | 18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | |
19 | +with open('pybuilddir.txt') as pybuilddir: | 19 | +with open('pybuilddir.txt') as pybuilddir: | |
20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | 20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | |
21 | + | 21 | + | |
22 | import argparse | 22 | import argparse | |
23 | import importlib._bootstrap | 23 | import importlib._bootstrap | |
24 | import importlib.machinery | 24 | import importlib.machinery | |
25 | @@ -13,6 +19,7 @@ import warnings | 25 | @@ -13,6 +19,7 @@ import warnings | |
26 | from glob import glob, escape | 26 | from glob import glob, escape | |
27 | import _osx_support | 27 | import _osx_support | |
28 | 28 | |||
29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/').match(p)] | 29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | |
30 | 30 | |||
31 | try: | 31 | try: | |
32 | import subprocess | 32 | import subprocess | |
33 | @@ -45,6 +52,7 @@ with warnings.catch_warnings(): | 33 | @@ -45,6 +52,7 @@ with warnings.catch_warnings(): | |
34 | DeprecationWarning | 34 | DeprecationWarning | |
35 | ) | 35 | ) | |
36 | 36 | |||
37 | + from distutils import text_file | 37 | + from distutils import text_file | |
38 | from distutils.command.build_ext import build_ext | 38 | from distutils.command.build_ext import build_ext | |
39 | from distutils.command.build_scripts import build_scripts | 39 | from distutils.command.build_scripts import build_scripts | |
40 | from distutils.command.install import install | 40 | from distutils.command.install import install | |
41 | @@ -58,7 +66,7 @@ with warnings.catch_warnings(): | 41 | @@ -58,7 +66,7 @@ with warnings.catch_warnings(): | |
42 | TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') | 42 | TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') |
@@ -1,21 +1,21 @@ | @@ -1,21 +1,21 @@ | |||
1 | $NetBSD: distinfo,v 1.29 2022/05/18 08:07:32 adam Exp $ | 1 | $NetBSD: distinfo,v 1.30 2022/07/07 15:26:43 khorben Exp $ | |
2 | 2 | |||
3 | BLAKE2s (Python-3.9.13.tar.xz) = e7774bfb171b74d6ba80e11c3c49a166832ff2fe466b37e885a250cd2a62ecf4 | 3 | BLAKE2s (Python-3.9.13.tar.xz) = e7774bfb171b74d6ba80e11c3c49a166832ff2fe466b37e885a250cd2a62ecf4 | |
4 | SHA512 (Python-3.9.13.tar.xz) = e9664e7f908092df11236b22465d217531d6f0378e88d889108d19fe77f28f46ffb629b8733f84b41409e255367321893a2b1bd64518930d9d8cae5d1b774d23 | 4 | SHA512 (Python-3.9.13.tar.xz) = e9664e7f908092df11236b22465d217531d6f0378e88d889108d19fe77f28f46ffb629b8733f84b41409e255367321893a2b1bd64518930d9d8cae5d1b774d23 | |
5 | Size (Python-3.9.13.tar.xz) = 19754368 bytes | 5 | Size (Python-3.9.13.tar.xz) = 19754368 bytes | |
6 | SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 | 6 | SHA1 (patch-Lib_ctypes_util.py) = 032cc99ebad93ddddfd89073c60424a952e3faa3 | |
7 | SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf | 7 | SHA1 (patch-Lib_distutils_sysconfig.py) = 6822eafb4dfded86d7f7353831816aeb8119e6cf | |
8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 | 8 | SHA1 (patch-Lib_distutils_unixccompiler.py) = 2e65a8dd5dd3fe25957206c062106fa7a6fc4e69 | |
9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2 | 9 | SHA1 (patch-Lib_lib2to3_pgen2_driver.py) = 5d6dab14197f27363394ff1aeee22a8ced8026d2 | |
10 | SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c | 10 | SHA1 (patch-Lib_sysconfig.py) = a4f009ed73ebbd9d9c4bf7e12b7981182ed8fd7c | |
11 | SHA1 (patch-Makefile.pre.in) = dd5ff571ac9fe2dc2e41fa678261d8e3648ac908 | 11 | SHA1 (patch-Makefile.pre.in) = dd5ff571ac9fe2dc2e41fa678261d8e3648ac908 | |
12 | SHA1 (patch-Modules___hashopenssl.c) = d7157254630259b2073e67a921edf0dfe151e32a | 12 | SHA1 (patch-Modules___hashopenssl.c) = d7157254630259b2073e67a921edf0dfe151e32a | |
13 | SHA1 (patch-Modules___ssl.c) = f241ba148e4c244a641386be5ac07817b03f04f7 | 13 | SHA1 (patch-Modules___ssl.c) = f241ba148e4c244a641386be5ac07817b03f04f7 | |
14 | SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 | 14 | SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567 | |
15 | SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d | 15 | SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d | |
16 | SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de | 16 | SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de | |
17 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | 17 | SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c | |
18 | SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be | 18 | SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be | |
19 | SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531 | 19 | SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531 | |
20 | SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e | 20 | SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e | |
21 | SHA1 (patch-setup.py) = 12e485a46c63bfe4da3ee6f9072bdab3694830d2 | 21 | SHA1 (patch-setup.py) = 81c2ddc3a343c62e228392572d3b6c88b5f49b51 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | $NetBSD: patch-setup.py,v 1.8 2022/04/03 10:51:19 riastradh Exp $ | 1 | $NetBSD: patch-setup.py,v 1.9 2022/07/07 15:26:43 khorben 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 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | 7 | Don't search for modules in PREFIX. Fixes build failure when py-setuptools | |
8 | are installed. | 8 | are installed. | |
9 | Enable cross-build by setting sys._home and sys.path to build directory | 9 | Enable cross-build by setting sys._home and sys.path to build directory | |
10 | 10 | |||
11 | --- setup.py.orig 2022-03-23 21:12:08.000000000 +0000 | 11 | --- setup.py.orig 2022-03-23 21:12:08.000000000 +0000 | |
12 | +++ setup.py | 12 | +++ setup.py | |
13 | @@ -1,5 +1,11 @@ | 13 | @@ -1,5 +1,11 @@ | |
14 | # Autodetecting setup.py script for building the Python extensions | 14 | # Autodetecting setup.py script for building the Python extensions | |
@@ -16,27 +16,27 @@ Enable cross-build by setting sys._home | @@ -16,27 +16,27 @@ Enable cross-build by setting sys._home | |||
16 | +import sys | 16 | +import sys | |
17 | +sys._home = __file__[:-len('/setup.py')] | 17 | +sys._home = __file__[:-len('/setup.py')] | |
18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | 18 | +sys.path.append(__file__[:-len('/setup.py')] + '/Lib') | |
19 | +with open('pybuilddir.txt') as pybuilddir: | 19 | +with open('pybuilddir.txt') as pybuilddir: | |
20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | 20 | + sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir)) | |
21 | + | 21 | + | |
22 | import argparse | 22 | import argparse | |
23 | import importlib._bootstrap | 23 | import importlib._bootstrap | |
24 | import importlib.machinery | 24 | import importlib.machinery | |
25 | @@ -11,6 +17,7 @@ import sysconfig | 25 | @@ -11,6 +17,7 @@ import sysconfig | |
26 | from glob import glob, escape | 26 | from glob import glob, escape | |
27 | import _osx_support | 27 | import _osx_support | |
28 | 28 | |||
29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/').match(p)] | 29 | +sys.path = [p for p in sys.path if not re.compile('^' + sys.base_prefix + '/lib').match(p)] | |
30 | 30 | |||
31 | try: | 31 | try: | |
32 | import subprocess | 32 | import subprocess | |
33 | @@ -30,7 +37,7 @@ except ImportError: | 33 | @@ -30,7 +37,7 @@ except ImportError: | |
34 | SUBPROCESS_BOOTSTRAP = True | 34 | SUBPROCESS_BOOTSTRAP = True | |
35 | 35 | |||
36 | 36 | |||
37 | -from distutils import log | 37 | -from distutils import log | |
38 | +from distutils import log, text_file | 38 | +from distutils import log, text_file | |
39 | from distutils.command.build_ext import build_ext | 39 | from distutils.command.build_ext import build_ext | |
40 | from distutils.command.build_scripts import build_scripts | 40 | from distutils.command.build_scripts import build_scripts | |
41 | from distutils.command.install import install | 41 | from distutils.command.install import install | |
42 | @@ -44,7 +51,7 @@ from distutils.spawn import find_executa | 42 | @@ -44,7 +51,7 @@ from distutils.spawn import find_executa |