From 2fc12290ad34dd35fb37ee02d50d3dfa574b909b Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 27 Jun 2024 19:32:26 +0000 Subject: [PATCH] Add support for free-threaded Python See #2984 --- plugins/python-build/bin/python-build | 7 +++++++ plugins/python-build/share/python-build/3.13t-dev | 8 ++++++++ plugins/python-build/share/python-build/3.14t-dev | 8 ++++++++ 3 files changed, 23 insertions(+) create mode 100644 plugins/python-build/share/python-build/3.13t-dev create mode 100644 plugins/python-build/share/python-build/3.14t-dev diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 923fcc62..a0be4fbf 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -822,6 +822,7 @@ build_package_standard_build() { use_homebrew_zlib || true fi use_dsymutil || true + use_free_threading || true fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -1761,6 +1762,12 @@ use_dsymutil() { fi } +use_free_threading() { + if [[ -n "$PYTHON_BUILD_FREE_THREADING" ]]; then + package_option python configure --disable-gil + fi +} + build_package_enable_shared() { package_option python configure --enable-shared } diff --git a/plugins/python-build/share/python-build/3.13t-dev b/plugins/python-build/share/python-build/3.13t-dev new file mode 100644 index 00000000..ce931aa1 --- /dev/null +++ b/plugins/python-build/share/python-build/3.13t-dev @@ -0,0 +1,8 @@ +prefer_openssl3 +export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 +export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1 +export PYTHON_BUILD_CONFIGURE_WITH_DSYMUTIL=1 +export PYTHON_BUILD_FREE_THREADING=1 +install_package "openssl-3.3.0" "https://www.openssl.org/source/openssl-3.3.0.tar.gz#53e66b043322a606abf0087e7699a0e033a37fa13feb9742df35c3a33b18fb02" mac_openssl --if has_broken_mac_openssl +install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline +install_git "Python-3.13-dev" "https://github.com/python/cpython" 3.13 standard verify_py313 copy_python_gdb ensurepip diff --git a/plugins/python-build/share/python-build/3.14t-dev b/plugins/python-build/share/python-build/3.14t-dev new file mode 100644 index 00000000..027e7f91 --- /dev/null +++ b/plugins/python-build/share/python-build/3.14t-dev @@ -0,0 +1,8 @@ +prefer_openssl3 +export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1 +export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1 +export PYTHON_BUILD_CONFIGURE_WITH_DSYMUTIL=1 +export PYTHON_BUILD_FREE_THREADING=1 +install_package "openssl-3.3.0" "https://www.openssl.org/source/openssl-3.3.0.tar.gz#53e66b043322a606abf0087e7699a0e033a37fa13feb9742df35c3a33b18fb02" mac_openssl --if has_broken_mac_openssl +install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline +install_git "Python-3.14-dev" "https://github.com/python/cpython" main standard verify_py314 copy_python_gdb ensurepip