From 0a3bc3d255692a80f397023d7dceb9980c6a09cc Mon Sep 17 00:00:00 2001 From: jim wang <122244446+jimwang118@users.noreply.github.com> Date: Thu, 27 Apr 2023 02:51:50 +0800 Subject: [PATCH] [python3] Fix distutils path (#30822) Co-authored-by: Billy Robert O'Neal III --- ports/python3/0012-force-disable-curses.patch | 14 +++++- .../python3/0013-configure-no-libcrypt.patch | 25 ++++++++--- .../0014-fix-get-python-inc-output.patch | 44 +++++++++++++++++++ ports/python3/portfile.cmake | 1 + ports/python3/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/p-/python3.json | 5 +++ 7 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 ports/python3/0014-fix-get-python-inc-output.patch diff --git a/ports/python3/0012-force-disable-curses.patch b/ports/python3/0012-force-disable-curses.patch index d0986e80d8..01e5dcf15b 100644 --- a/ports/python3/0012-force-disable-curses.patch +++ b/ports/python3/0012-force-disable-curses.patch @@ -1,5 +1,14 @@ +From 08599a02debaa2ea015d1221dd2c8ca0481640a3 Mon Sep 17 00:00:00 2001 +From: Billy Robert O'Neal III +Date: Wed, 26 Apr 2023 05:17:09 +0000 +Subject: [PATCH 12/14] force disable curses + +--- + Modules/Setup | 4 ++++ + 1 file changed, 4 insertions(+) + diff --git a/Modules/Setup b/Modules/Setup -index 87c6a15..7ad53f5 100644 +index 87c6a152f8..7ad53f5b4f 100644 --- a/Modules/Setup +++ b/Modules/Setup @@ -375,3 +375,7 @@ xxsubtype xxsubtype.c @@ -10,3 +19,6 @@ index 87c6a15..7ad53f5 100644 +*disabled* +_curses +_curses_panel +-- +2.25.1 + diff --git a/ports/python3/0013-configure-no-libcrypt.patch b/ports/python3/0013-configure-no-libcrypt.patch index dfeb9b77b7..f75ac86c30 100644 --- a/ports/python3/0013-configure-no-libcrypt.patch +++ b/ports/python3/0013-configure-no-libcrypt.patch @@ -1,8 +1,18 @@ +From f2c5695f17ec59f4badd374daabccf362bbd5f24 Mon Sep 17 00:00:00 2001 +From: Billy Robert O'Neal III +Date: Wed, 26 Apr 2023 05:17:22 +0000 +Subject: [PATCH 13/14] configure no libcrypt + +--- + configure | 3 +++ + configure.ac | 3 +++ + 2 files changed, 6 insertions(+) + diff --git a/configure b/configure -index 15c7c54b0953..70f28b0c7064 100755 +index bad619963a..c443360280 100755 --- a/configure +++ b/configure -@@ -13227,6 +13227,8 @@ done +@@ -13239,6 +13239,8 @@ done # We search for both crypt and crypt_r as one or the other may be defined # This gets us our -lcrypt in LIBS when required on the target platform. @@ -11,7 +21,7 @@ index 15c7c54b0953..70f28b0c7064 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5 $as_echo_n "checking for library containing crypt... " >&6; } if ${ac_cv_search_crypt+:} false; then : -@@ -13368,6 +13370,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +@@ -13380,6 +13382,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -20,10 +30,10 @@ index 15c7c54b0953..70f28b0c7064 100755 for ac_func in clock_gettime do : diff --git a/configure.ac b/configure.ac -index 6c65b2914bf6..afdc68363cea 100644 +index cc69015b10..a6c72c1014 100644 --- a/configure.ac +++ b/configure.ac -@@ -4085,6 +4085,8 @@ AC_CHECK_FUNCS(setpgrp, +@@ -4056,6 +4056,8 @@ AC_CHECK_FUNCS(setpgrp, # We search for both crypt and crypt_r as one or the other may be defined # This gets us our -lcrypt in LIBS when required on the target platform. @@ -32,7 +42,7 @@ index 6c65b2914bf6..afdc68363cea 100644 AC_SEARCH_LIBS(crypt, crypt) AC_SEARCH_LIBS(crypt_r, crypt) -@@ -4099,6 +4101,7 @@ char *r = crypt_r("", "", &d); +@@ -4070,6 +4072,7 @@ char *r = crypt_r("", "", &d); [AC_DEFINE(HAVE_CRYPT_R, 1, [Define if you have the crypt_r() function.])], []) ) @@ -40,3 +50,6 @@ index 6c65b2914bf6..afdc68363cea 100644 AC_CHECK_FUNCS(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime, [ +-- +2.25.1 + diff --git a/ports/python3/0014-fix-get-python-inc-output.patch b/ports/python3/0014-fix-get-python-inc-output.patch new file mode 100644 index 0000000000..a20d2673ac --- /dev/null +++ b/ports/python3/0014-fix-get-python-inc-output.patch @@ -0,0 +1,44 @@ +From b6ffa6e7a0f7a013fb111e618a7f7e2c58e9d548 Mon Sep 17 00:00:00 2001 +From: Billy Robert O'Neal III +Date: Wed, 26 Apr 2023 05:17:44 +0000 +Subject: [PATCH 14/14] fix get python inc output + +--- + Lib/distutils/sysconfig.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 3414a761e7..e6ae456ee9 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -45,7 +45,7 @@ + get_makefile_filename, + get_python_version, + ) +- ++from os.path import dirname + # This is better than + # from sysconfig import _CONFIG_VARS as _config_vars + # because it makes sure that the global dictionary is initialized +@@ -292,6 +292,7 @@ def get_python_inc(plat_specific=0, prefix=None): + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) + python_dir = 'python' + get_python_version() + build_flags ++ prefix = dirname(dirname(BASE_PREFIX)) + return os.path.join(prefix, "include", python_dir) + elif os.name == "nt": + if python_build: +@@ -299,7 +300,9 @@ def get_python_inc(plat_specific=0, prefix=None): + # pyconfig.h + return (os.path.join(prefix, "include") + os.path.pathsep + + os.path.join(prefix, "PC")) +- return os.path.join(prefix, "include") ++ python_dir = 'python' + get_python_version() + build_flags ++ prefix = dirname(dirname(BASE_PREFIX)) ++ return os.path.join(prefix, "include", python_dir) + else: + raise DistutilsPlatformError( + "I don't know where Python installs its C header files " +-- +2.25.1 + diff --git a/ports/python3/portfile.cmake b/ports/python3/portfile.cmake index 14248aaaa7..bc07fbdea1 100644 --- a/ports/python3/portfile.cmake +++ b/ports/python3/portfile.cmake @@ -18,6 +18,7 @@ set(PATCHES 0010-dont-skip-rpath.patch 0012-force-disable-curses.patch 0013-configure-no-libcrypt.patch # https://github.com/python/cpython/pull/28881 + 0014-fix-get-python-inc-output.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") diff --git a/ports/python3/vcpkg.json b/ports/python3/vcpkg.json index a45ff7f8fd..41d65148f7 100644 --- a/ports/python3/vcpkg.json +++ b/ports/python3/vcpkg.json @@ -1,7 +1,7 @@ { "name": "python3", "version": "3.10.7", - "port-version": 5, + "port-version": 6, "description": "The Python programming language", "homepage": "https://github.com/python/cpython", "license": "Python-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index 246fa331d4..1847be8258 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6382,7 +6382,7 @@ }, "python3": { "baseline": "3.10.7", - "port-version": 5 + "port-version": 6 }, "qca": { "baseline": "2.3.5", diff --git a/versions/p-/python3.json b/versions/p-/python3.json index b418509a71..88aa979324 100644 --- a/versions/p-/python3.json +++ b/versions/p-/python3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d3a8a2c668d77aaf0fa1862c6b3eff5018519e19", + "version": "3.10.7", + "port-version": 6 + }, { "git-tree": "43e3e2453968d19d674b96aea99718541c96d852", "version": "3.10.7",