From 92276b23a3e7bc3d4617993280d3eae9d86fc707 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 11 Feb 2025 16:47:25 -0600 Subject: [PATCH 1/8] tcl/tk: upgrade from 8.6.12 -> 8.6.14 Let's stay modern. Should address #296. --- cpython-unix/build.py | 2 +- pythonbuild/downloads.py | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/cpython-unix/build.py b/cpython-unix/build.py index c5d73a1c..e9b7d6cd 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -905,7 +905,7 @@ def build_cpython( "itcl4.2.4", "tcl8", "tcl8.6", - "thread2.8.7", + "thread2.8.79", "tk8.6", ] diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index e1562c04..d4f586e5 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -342,31 +342,6 @@ "size": 9497943, "sha256": "9b8e77d55f40ceaedd140ccca0daa804f0d43346d5abfcead9b547b5590f82f8", "version": "8.6.14", - "git_commit": "c624cc881bd0e5071dec9de4b120cbe9985d8c14", - }, - "tcl-8612": { - "url": "https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz", - "size": 10353486, - "sha256": "26c995dd0f167e48b11961d891ee555f680c175f7173ff8cb829f4ebcde4c1a6", - "version": "8.6.12", - "library_names": ["tcl8.6"], - "licenses": ["TCL"], - "license_file": "LICENSE.tcl.txt", - }, - "tk-8612": { - "url": "https://prdownloads.sourceforge.net/tcl/tk8.6.12-src.tar.gz", - "size": 4515393, - "sha256": "12395c1f3fcb6bed2938689f797ea3cdf41ed5cb6c4766eec8ac949560310630", - "version": "8.6.12", - "library_names": ["tk8.6"], - "licenses": ["TCL"], - "license_file": "LICENSE.tcl.txt", - }, - "tk-windows-bin-8612": { - "url": "https://github.com/python/cpython-bin-deps/archive/e3c3e9a2856124aa32b608632a52742d479eb7a9.tar.gz", - "size": 6787654, - "sha256": "01ad9c663659224e075d487cbc33ea2fed7a225593965b79bed92ca7f79b676f", - "version": "8.6.12", "git_commit": "e3c3e9a2856124aa32b608632a52742d479eb7a9", }, "uuid": { From bcdedcca82c39965feab5faf454e8aafefc331b7 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 11 Feb 2025 16:48:16 -0600 Subject: [PATCH 2/8] Fix `tk-windows-bin.git_commit` value --- pythonbuild/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index d4f586e5..d05d1d20 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -342,7 +342,7 @@ "size": 9497943, "sha256": "9b8e77d55f40ceaedd140ccca0daa804f0d43346d5abfcead9b547b5590f82f8", "version": "8.6.14", - "git_commit": "e3c3e9a2856124aa32b608632a52742d479eb7a9", + "git_commit": "c624cc881bd0e5071dec9de4b120cbe9985d8c14", }, "uuid": { "url": "https://sourceforge.net/projects/libuuid/files/libuuid-1.0.3.tar.gz", From 15e0f23dd25c2b14e8f30765321d95def6e12375 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 4 Sep 2024 18:51:29 -0500 Subject: [PATCH 3/8] Attempt to remove the `zlib1.dll` from tcltk builds --- cpython-windows/build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 5fce1abf..e5c386dc 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -456,6 +456,13 @@ def hack_props( rb"%s\$(ArchName)\" % tcltk_path, ) + try: + static_replace_in_file( + tcltkprops_path, rb"zlib1.dll", rb"" + ) + except NoSearchStringError: + pass + # We want to statically link against OpenSSL. This requires using our own # OpenSSL build. This requires some hacking of various files. openssl_props = pcbuild_path / "openssl.props" From 44d71a477e43ed03132b8b6259c34ab4595e685b Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 1 Jan 2025 15:54:15 -0600 Subject: [PATCH 4/8] Revert accidental typo --- cpython-unix/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpython-unix/build.py b/cpython-unix/build.py index e9b7d6cd..c5d73a1c 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -905,7 +905,7 @@ def build_cpython( "itcl4.2.4", "tcl8", "tcl8.6", - "thread2.8.79", + "thread2.8.7", "tk8.6", ] From 2659ec3c4c33427f3bfadd2b296d294106987a67 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 1 Jan 2025 15:54:32 -0600 Subject: [PATCH 5/8] Revert "Attempt to remove the `zlib1.dll` from tcltk builds" This reverts commit 97b944863bac338eff82c4b8e61a3bb8ac1a7fa0. --- cpython-windows/build.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index e5c386dc..5fce1abf 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -456,13 +456,6 @@ def hack_props( rb"%s\$(ArchName)\" % tcltk_path, ) - try: - static_replace_in_file( - tcltkprops_path, rb"zlib1.dll", rb"" - ) - except NoSearchStringError: - pass - # We want to statically link against OpenSSL. This requires using our own # OpenSSL build. This requires some hacking of various files. openssl_props = pcbuild_path / "openssl.props" From e75eff9a36f5f8ed4e4a5446f8a2e273cda95cdc Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 13 Jan 2025 15:06:44 -0600 Subject: [PATCH 6/8] Allow bundled zlib1 --- src/validation.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/validation.rs b/src/validation.rs index 33e61e2e..da59da28 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -139,6 +139,8 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "sqlite3.dll", "tcl86t.dll", "tk86t.dll", + // Bundled with tk + "zlib1.dll", ]; // CPython 3.14 and ARM64 use a newer version of tcl/tk (8.6.14+) which includes a bundled zlib that From fc0e64018239ad3b5f043305c47d77806f245ffa Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 13 Jan 2025 23:21:01 -0600 Subject: [PATCH 7/8] Add `msvcrt.dll` to allowed libraries --- src/validation.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validation.rs b/src/validation.rs index da59da28..ee3daa08 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -101,6 +101,7 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "IPHLPAPI.DLL", "KERNEL32.dll", "msi.dll", + "msvcrt.dll", "NETAPI32.dll", "ole32.dll", "OLEAUT32.dll", From a48868dac3c06d341a3831362b20f546ac0b606b Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 11 Feb 2025 16:49:35 -0600 Subject: [PATCH 8/8] Drop 8612 special case --- cpython-windows/build.py | 41 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 5fce1abf..b2a807b4 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -122,7 +122,7 @@ "_lzma": ["xz"], "_sqlite3": ["sqlite"], "_ssl": ["openssl"], - "_tkinter": ["tcl-8612", "tk-8612", "tix"], + "_tkinter": ["tcl", "tk", "tix"], "_uuid": ["uuid"], "zlib": ["zlib"], "_zstd": ["zstd"], @@ -370,10 +370,7 @@ def hack_props( mpdecimal_version = DOWNLOADS["mpdecimal"]["version"] - if meets_python_minimum_version(python_version, "3.14") or arch == "arm64": - tcltk_commit = DOWNLOADS["tk-windows-bin"]["git_commit"] - else: - tcltk_commit = DOWNLOADS["tk-windows-bin-8612"]["git_commit"] + tcltk_commit = DOWNLOADS["tk-windows-bin"]["git_commit"] sqlite_path = td / ("sqlite-autoconf-%s" % sqlite_version) bzip2_path = td / ("bzip2-%s" % bzip2_version) @@ -1220,10 +1217,6 @@ def find_additional_dependencies(project: pathlib.Path): if name == "zlib": name = zlib_entry - # On 3.14+ and aarch64, we use the latest tcl/tk version - if ext == "_tkinter" and (python_majmin == "314" or arch == "arm64"): - name = name.replace("-8612", "") - download_entry = DOWNLOADS[name] # This will raise if no license metadata defined. This is @@ -1307,17 +1300,8 @@ def build_cpython( setuptools_wheel = download_entry("setuptools", BUILD) pip_wheel = download_entry("pip", BUILD) - # On CPython 3.14+, we use the latest tcl/tk version which has additional - # runtime dependencies, so we are conservative and use the old version - # elsewhere. The old version isn't built for arm64, so we use the new - # version there too - tk_bin_entry = ( - "tk-windows-bin" - if meets_python_minimum_version(python_version, "3.14") or arch == "arm64" - else "tk-windows-bin-8612" - ) tk_bin_archive = download_entry( - tk_bin_entry, BUILD, local_name="tk-windows-bin.tar.gz" + "tk-windows-bin", BUILD, local_name="tk-windows-bin.tar.gz" ) # On CPython 3.14+, zstd is included @@ -1401,16 +1385,15 @@ def build_cpython( shutil.copyfile(source, dest) # Delete the tk nmake helper, it's not needed and links msvc - if tk_bin_entry == "tk-windows-bin": - tcltk_commit: str = DOWNLOADS[tk_bin_entry]["git_commit"] - tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit) - ( - tcltk_path - / build_directory - / "lib" - / "nmake" - / "x86_64-w64-mingw32-nmakehlp.exe" - ).unlink() + tcltk_commit: str = DOWNLOADS["tk-windows-bin"]["git_commit"] + tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit) + ( + tcltk_path + / build_directory + / "lib" + / "nmake" + / "x86_64-w64-mingw32-nmakehlp.exe" + ).unlink() cpython_source_path = td / ("Python-%s" % python_version) pcbuild_path = cpython_source_path / "PCbuild"