From 5599ae4ccf2e62d9f47d08a98c4b46593da6c43e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 18 Nov 2022 14:53:08 -0500 Subject: [PATCH] [python3] Bump to 3.10.7 (#27558) * [python3] Make patch files contiguous. When applying these back to the python3 repository and re-formatting, the gap in patch file numbers requires annoying manual renaming. Debunk that. * [python3] Use patch files, not diffs. Diffs require multiple steps to import into the python3 repository. Debunk that. The patch format retains authorship information. * [python3] Fix problems with conflicting patches. Something modified in the static library patch was being used as a context line in a later patch. How did this pass CI? * [python3] Bump to 3.10.7. * [python3] Fix Windows 7 patch. * [python3] Back out trivial patch changes. * [python3] Apply unconditional patches first. * version things and stuff * Bump Python tools to 3.10.7. --- ...> 0001-only-build-required-projects.patch} | 2 ++ ...ibrary.patch => 0002-static-library.patch} | 28 +++++++-------- ...g-zlib.patch => 0003-use-vcpkg-zlib.patch} | 2 +- ...0004-devendor-external-dependencies.patch} | 0 ...e.patch => 0005-dont-copy-vcruntime.patch} | 0 .../0006-restore-support-for-windows-7.patch | 18 ++++++++++ ports/python3/0008-python.pc.patch | 34 +++++++++++++++++++ .../{0010-bz2d.patch => 0009-bz2d.patch} | 13 +++++++ ports/python3/0009-python.pc.patch | 16 --------- ...rpath.patch => 0010-dont-skip-rpath.patch} | 12 +++++++ ...s-fix.patch => 0011-gcc-ldflags-fix.patch} | 12 +++++++ ports/python3/portfile.cmake | 24 +++++++------ ports/python3/vcpkg.json | 3 +- .../cmake/vcpkg_find_acquire_program.cmake | 6 ++-- scripts/vcpkgTools.xml | 16 ++++----- versions/baseline.json | 4 +-- versions/p-/python3.json | 5 +++ 17 files changed, 138 insertions(+), 57 deletions(-) rename ports/python3/{0005-only-build-required-projects.patch => 0001-only-build-required-projects.patch} (97%) rename ports/python3/{0001-static-library.patch => 0002-static-library.patch} (99%) rename ports/python3/{0002-use-vcpkg-zlib.patch => 0003-use-vcpkg-zlib.patch} (95%) rename ports/python3/{0003-devendor-external-dependencies.patch => 0004-devendor-external-dependencies.patch} (100%) rename ports/python3/{0004-dont-copy-vcruntime.patch => 0005-dont-copy-vcruntime.patch} (100%) create mode 100644 ports/python3/0008-python.pc.patch rename ports/python3/{0010-bz2d.patch => 0009-bz2d.patch} (70%) delete mode 100644 ports/python3/0009-python.pc.patch rename ports/python3/{0011-dont-skip-rpath.patch => 0010-dont-skip-rpath.patch} (96%) rename ports/python3/{0012-gcc-ldflags-fix.patch => 0011-gcc-ldflags-fix.patch} (85%) diff --git a/ports/python3/0005-only-build-required-projects.patch b/ports/python3/0001-only-build-required-projects.patch similarity index 97% rename from ports/python3/0005-only-build-required-projects.patch rename to ports/python3/0001-only-build-required-projects.patch index 2d616a0d2f..952f8daebe 100644 --- a/ports/python3/0005-only-build-required-projects.patch +++ b/ports/python3/0001-only-build-required-projects.patch @@ -27,6 +27,8 @@ index 4d416c589e..ede9868a8f 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -49,17 +49,17 @@ + + - + diff --git a/ports/python3/0001-static-library.patch b/ports/python3/0002-static-library.patch similarity index 99% rename from ports/python3/0001-static-library.patch rename to ports/python3/0002-static-library.patch index 980078f5f5..bf40a2de13 100644 --- a/ports/python3/0001-static-library.patch +++ b/ports/python3/0002-static-library.patch @@ -36,6 +36,19 @@ index d7d3cf081e..34269f0b75 100644 #endif /* MS_COREDLL */ #if defined(MS_WIN64) +diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj +index 70c336a9d3..ba797e8afd 100644 +--- a/PCbuild/pcbuild.proj ++++ b/PCbuild/pcbuild.proj +@@ -45,7 +45,7 @@ + false + + +- ++ + + + diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 2625d0293d..2f8bdaa931 100644 --- a/PCbuild/pythoncore.vcxproj @@ -62,7 +75,7 @@ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ac49f7867a..f3583345ff 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c -@@ -2804,6 +2804,9 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict) +@@ -2804,6 +2804,9 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict #ifdef MS_COREDLL SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString); @@ -72,19 +85,6 @@ index ac49f7867a..f3583345ff 100644 #endif #ifdef ABIFLAGS SET_SYS_FROM_STRING("abiflags", ABIFLAGS); -diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj -index 70c336a9d3..ba797e8afd 100644 ---- a/PCbuild/pcbuild.proj -+++ b/PCbuild/pcbuild.proj -@@ -45,7 +45,7 @@ - false - - -- -+ - - - -- 2.28.0.windows.1 diff --git a/ports/python3/0002-use-vcpkg-zlib.patch b/ports/python3/0003-use-vcpkg-zlib.patch similarity index 95% rename from ports/python3/0002-use-vcpkg-zlib.patch rename to ports/python3/0003-use-vcpkg-zlib.patch index c7f9dd60e0..2f619949a2 100644 --- a/ports/python3/0002-use-vcpkg-zlib.patch +++ b/ports/python3/0003-use-vcpkg-zlib.patch @@ -26,7 +26,7 @@ index dbe236829a..5f30a35eb3 100644 @@ -556,7 +558,7 @@ - + - diff --git a/ports/python3/0003-devendor-external-dependencies.patch b/ports/python3/0004-devendor-external-dependencies.patch similarity index 100% rename from ports/python3/0003-devendor-external-dependencies.patch rename to ports/python3/0004-devendor-external-dependencies.patch diff --git a/ports/python3/0004-dont-copy-vcruntime.patch b/ports/python3/0005-dont-copy-vcruntime.patch similarity index 100% rename from ports/python3/0004-dont-copy-vcruntime.patch rename to ports/python3/0005-dont-copy-vcruntime.patch diff --git a/ports/python3/0006-restore-support-for-windows-7.patch b/ports/python3/0006-restore-support-for-windows-7.patch index a8f343e843..cf8ed0a023 100644 --- a/ports/python3/0006-restore-support-for-windows-7.patch +++ b/ports/python3/0006-restore-support-for-windows-7.patch @@ -10,6 +10,24 @@ pathcch. The same mechanism is applied to fix posixmodule.c --- index 25ddc82..ff51042 100644 +--- a/Modules/_winapi.c ++++ b/Modules/_winapi.c +@@ -44,6 +44,15 @@ + #include + #include "winreparse.h" + ++// The Windws 7 patch lowers the API version such that these constants ++// are no longer defined by the Windows SDK. Debounce that. ++#ifndef LCMAP_SORTHANDLE ++# define LCMAP_SORTHANDLE 0x20000000 ++#endif ++#ifndef LCMAP_HASH ++# define LCMAP_HASH 0x00040000 ++#endif ++ + #if defined(MS_WIN32) && !defined(MS_WIN64) + #define HANDLE_TO_PYNUM(handle) \ + PyLong_FromUnsignedLong((unsigned long) handle) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c diff --git a/ports/python3/0008-python.pc.patch b/ports/python3/0008-python.pc.patch new file mode 100644 index 0000000000..e02dc1264a --- /dev/null +++ b/ports/python3/0008-python.pc.patch @@ -0,0 +1,34 @@ +From 3c43def510e7c4c115fbe3938db8e4fe9bc2e311 Mon Sep 17 00:00:00 2001 +From: Max Khon +Date: Tue, 8 Feb 2022 12:58:30 +0700 +Subject: [PATCH 08/11] python.pc + +Fix pkgconfig for debug Linux builds (#22529) +--- + Misc/python-embed.pc.in | 2 +- + Misc/python.pc.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Misc/python-embed.pc.in b/Misc/python-embed.pc.in +index 2be9df8143..92142dfe68 100644 +--- a/Misc/python-embed.pc.in ++++ b/Misc/python-embed.pc.in +@@ -10,4 +10,4 @@ Requires: + Version: @VERSION@ + Libs.private: @LIBS@ + Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@ +-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ ++Cflags: -I${includedir}/python@VERSION@ +diff --git a/Misc/python.pc.in b/Misc/python.pc.in +index 87e04decc2..0349dc81ba 100644 +--- a/Misc/python.pc.in ++++ b/Misc/python.pc.in +@@ -10,4 +10,4 @@ Requires: + Version: @VERSION@ + Libs.private: @LIBS@ + Libs: +-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ ++Cflags: -I${includedir}/python@VERSION@ +-- +2.37.3.windows.1 + diff --git a/ports/python3/0010-bz2d.patch b/ports/python3/0009-bz2d.patch similarity index 70% rename from ports/python3/0010-bz2d.patch rename to ports/python3/0009-bz2d.patch index 162cc7caba..70e1b925b4 100644 --- a/ports/python3/0010-bz2d.patch +++ b/ports/python3/0009-bz2d.patch @@ -1,3 +1,13 @@ +From a45e64a57c58a9fe4984b866e86c7b661da7940d Mon Sep 17 00:00:00 2001 +From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> +Date: Mon, 14 Mar 2022 09:09:48 +0100 +Subject: [PATCH 09/11] bz2d + +fix bz2(d) search on linux (#23525) +--- + setup.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + diff --git a/setup.py b/setup.py index 43e807f20..df4d43d3d 100644 --- a/setup.py @@ -17,3 +27,6 @@ index 43e807f20..df4d43d3d 100644 else: self.missing.append('_bz2') +-- +2.37.3.windows.1 + diff --git a/ports/python3/0009-python.pc.patch b/ports/python3/0009-python.pc.patch deleted file mode 100644 index 173be389da..0000000000 --- a/ports/python3/0009-python.pc.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/Misc/python.pc.in 2022-01-14 05:23:10.299912709 +0000 -+++ b/Misc/python.pc.in 2022-01-14 05:23:15.908022446 +0000 -@@ -10,4 +10,4 @@ - Version: @VERSION@ - Libs.private: @LIBS@ - Libs: --Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ -+Cflags: -I${includedir}/python@VERSION@ ---- a/Misc/python-embed.pc.in 2022-01-14 05:22:57.043653570 +0000 -+++ b/Misc/python-embed.pc.in 2022-01-14 05:23:04.603801315 +0000 -@@ -10,4 +10,4 @@ - Version: @VERSION@ - Libs.private: @LIBS@ - Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@ --Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ -+Cflags: -I${includedir}/python@VERSION@ diff --git a/ports/python3/0011-dont-skip-rpath.patch b/ports/python3/0010-dont-skip-rpath.patch similarity index 96% rename from ports/python3/0011-dont-skip-rpath.patch rename to ports/python3/0010-dont-skip-rpath.patch index 82ce23b748..400cd61a32 100644 --- a/ports/python3/0011-dont-skip-rpath.patch +++ b/ports/python3/0010-dont-skip-rpath.patch @@ -1,3 +1,12 @@ +From f7439eae9b2f8d91b6689efbf01292a044f3a3fe Mon Sep 17 00:00:00 2001 +From: Osyotr +Date: Thu, 4 Aug 2022 23:49:06 +0300 +Subject: [PATCH 10/11] dont skip rpath + +--- + setup.py | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + diff --git a/setup.py b/setup.py index 61b3266..4c2cfb4 100644 --- a/setup.py @@ -156,3 +165,6 @@ index 61b3266..4c2cfb4 100644 include_dirs=includes_dirs)) +-- +2.37.3.windows.1 + diff --git a/ports/python3/0012-gcc-ldflags-fix.patch b/ports/python3/0011-gcc-ldflags-fix.patch similarity index 85% rename from ports/python3/0012-gcc-ldflags-fix.patch rename to ports/python3/0011-gcc-ldflags-fix.patch index a0063f8db9..195a43785b 100644 --- a/ports/python3/0012-gcc-ldflags-fix.patch +++ b/ports/python3/0011-gcc-ldflags-fix.patch @@ -1,3 +1,12 @@ +From 84652c4c5658fd443a05bf54fe6040857ba9c36c Mon Sep 17 00:00:00 2001 +From: Christoph Neuhauser +Date: Sat, 15 Oct 2022 01:14:12 +0200 +Subject: [PATCH 11/11] gcc ldflags fix + +--- + Lib/distutils/unixccompiler.py | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index d00c48981e..b14ce8454e 100644 --- a/Lib/distutils/unixccompiler.py @@ -40,3 +49,6 @@ index d00c48981e..b14ce8454e 100644 def runtime_library_dir_option(self, dir): # XXX Hackish, at the very least. See Python bug #445902: +-- +2.37.3.windows.1 + diff --git a/ports/python3/portfile.cmake b/ports/python3/portfile.cmake index 01e7cb2d35..b6c8ed2991 100644 --- a/ports/python3/portfile.cmake +++ b/ports/python3/portfile.cmake @@ -5,24 +5,26 @@ endif() set(PYTHON_VERSION_MAJOR 3) set(PYTHON_VERSION_MINOR 10) -set(PYTHON_VERSION_PATCH 5) +set(PYTHON_VERSION_PATCH 7) set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}) set(PATCHES - 0002-use-vcpkg-zlib.patch - 0003-devendor-external-dependencies.patch - 0004-dont-copy-vcruntime.patch - 0005-only-build-required-projects.patch - 0009-python.pc.patch - 0010-bz2d.patch - 0011-dont-skip-rpath.patch + 0001-only-build-required-projects.patch + 0003-use-vcpkg-zlib.patch + 0004-devendor-external-dependencies.patch + 0005-dont-copy-vcruntime.patch + 0008-python.pc.patch + 0009-bz2d.patch + 0010-dont-skip-rpath.patch ) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - list(PREPEND PATCHES 0001-static-library.patch) + list(APPEND PATCHES 0002-static-library.patch) endif() + # Fix build failures with GCC for built-in modules (https://github.com/microsoft/vcpkg/issues/26573) if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - list(APPEND PATCHES 0012-gcc-ldflags-fix.patch) + list(APPEND PATCHES 0011-gcc-ldflags-fix.patch) endif() # Python 3.9 removed support for Windows 7. This patch re-adds support for Windows 7 and is therefore @@ -47,7 +49,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO python/cpython REF v${PYTHON_VERSION} - SHA512 7a736c6bf76735f66eba50bc055661c46fefce1496869c51e9b6b264bca456d2f2c6de293dfc3bc15a9d1df4b633d7f6f66ed86696e71a36e500354a75f4200f + SHA512 88bf6efef632a7dad7306a59b7d5da159947d6675f0d264f1f33aa49a5703b4e4595011de52098eb839cc648994ae143f668507be7209f6bf3fe8ae0ec6a9125 HEAD_REF master PATCHES ${PATCHES} ) diff --git a/ports/python3/vcpkg.json b/ports/python3/vcpkg.json index f7eb0dd186..fe25e1437b 100644 --- a/ports/python3/vcpkg.json +++ b/ports/python3/vcpkg.json @@ -1,7 +1,6 @@ { "name": "python3", - "version": "3.10.5", - "port-version": 4, + "version": "3.10.7", "description": "The Python programming language", "homepage": "https://github.com/python/cpython", "license": "Python-2.0", diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 4611af6511..83d729b7a9 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -224,17 +224,17 @@ function(vcpkg_find_acquire_program program) elseif(program STREQUAL "PYTHON3") if(CMAKE_HOST_WIN32) set(program_name python) - set(program_version 3.10.5) + set(program_version 3.10.7) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(tool_subdirectory "python-${program_version}-x86") set(download_urls "https://www.python.org/ftp/python/${program_version}/python-${program_version}-embed-win32.zip") set(download_filename "python-${program_version}-embed-win32.zip") - set(download_sha512 7598cf838401d87c4aadb43f1d70a66c647b5c4c86d55eed747126eb21e699ee8e662eef50782eabe10c746ae3947a7f1418fa9e2c1131ca8f3ed06dcb48b00f) + set(download_sha512 a69445906a909ce5f2554c544fe4251a8ab9c5028b531975b8c78fa8e98295b2bf06e1840f346a3c0edf485a7792c40c9d318bffd36b9c7829ac72b7cf8697bc) else() set(tool_subdirectory "python-${program_version}-x64") set(download_urls "https://www.python.org/ftp/python/${program_version}/python-${program_version}-embed-amd64.zip") set(download_filename "python-${program_version}-embed-amd64.zip") - set(download_sha512 17b1e00af8a051a4d319dd4bf340a6ad742c1b691faa30ea9f51bc0f2e9daccccd2745e2a081699428981d120d0c06007878ecaafca78936f4cfcab0054b4fb7) + set(download_sha512 29b47f8073b54c092a2c8b39b09ab392f757a8c09149e8d2de043907fffb250b5f6801175e16fedb4fae7b6555822acdc57d81d13c2fea95ef0f6ed717f86cb9) endif() set(paths_to_search "${DOWNLOADS}/tools/python/${tool_subdirectory}") vcpkg_list(SET post_install_command "${CMAKE_COMMAND}" -E rm python310._pth) diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index 39863e6c97..3cb14671df 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -1,18 +1,18 @@ - 3.10.5 + 3.10.7 python.exe - https://www.python.org/ftp/python/3.10.5/python-3.10.5-embed-win32.zip - 7598cf838401d87c4aadb43f1d70a66c647b5c4c86d55eed747126eb21e699ee8e662eef50782eabe10c746ae3947a7f1418fa9e2c1131ca8f3ed06dcb48b00f - python-3.10.5-embed-win32.zip + https://www.python.org/ftp/python/3.10.7/python-3.10.7-embed-win32.zip + a69445906a909ce5f2554c544fe4251a8ab9c5028b531975b8c78fa8e98295b2bf06e1840f346a3c0edf485a7792c40c9d318bffd36b9c7829ac72b7cf8697bc + python-3.10.7-embed-win32.zip - 3.10.5 + 3.10.7 tools\python.exe - https://www.nuget.org/api/v2/package/python/3.10.5 - be225985a23b685939ff6cb134fbe29b8fd6683cd6695753fc10ef4784dcc412fc98aa2dedca902cf0be5393dfd97724ea88331cda1bcd4b86a839e9d699de7d - python-3.10.5.nupkg.zip + https://www.nuget.org/api/v2/package/python/3.10.7 + dc763c4f3e9594619173a99740a6b54686c768c240efe316d4d3f8914383bd06420c0802781baf983ea840c49412b8330c1af93f31d2c73eb0ea22a55e71aa13 + python-3.10.7.nupkg.zip 3.24.0 diff --git a/versions/baseline.json b/versions/baseline.json index 205cb34d22..3a1a947ceb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6013,8 +6013,8 @@ "port-version": 5 }, "python3": { - "baseline": "3.10.5", - "port-version": 4 + "baseline": "3.10.7", + "port-version": 0 }, "qca": { "baseline": "2.3.4", diff --git a/versions/p-/python3.json b/versions/p-/python3.json index 15be433f1c..09ef4fd7e1 100644 --- a/versions/p-/python3.json +++ b/versions/p-/python3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "047f7eca7d1000287f2389302d5c292251d023f2", + "version": "3.10.7", + "port-version": 0 + }, { "git-tree": "a6bf44809eee3bfbce1b176e55d41beb54cac6f2", "version": "3.10.5",