diff --git a/plugins/python-build/README.md b/plugins/python-build/README.md index f6f4de5b..d0626482 100644 --- a/plugins/python-build/README.md +++ b/plugins/python-build/README.md @@ -186,7 +186,7 @@ You can set certain environment variables to control the build process. * `PYTHON_BUILD_USE_HOMEBREW`, if set, will search for libraries installed by Homebrew when it normally wouldn't. * `PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA`, override the Homebrew OpenSSL formula to use. * `PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA`, override the MacPorts OpenSSL formula to use. The default is `openssl3 openssl`. -* `PYTHON_BUILD_TCLTK_FORMULA`, override the Homebrew Tcl/Tk formula to use. +* `PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA`, override the Homebrew Tcl/Tk formula to use. * `PYTHON_BUILD_SKIP_MACPORTS`, if set, will not search for libraries installed by MacPorts when it normally would. * `PYTHON_BUILD_USE_MACPORTS`, if set, will search for libraries installed by MacPorts when it normally wouldn't. * `PYTHON_BUILD_ROOT` overrides the default location from where build definitions diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 12ea3f06..fd1240db 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -2006,9 +2006,14 @@ use_homebrew_tcltk() { can_use_homebrew || return 1 local tcltk_formula # Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024), - # tcl-tk is 9.0. It's supported in CPython since 3.14.0a1 (gh-124111) but is not officially supported as of 3.14.0 - # so we prefer 8 - for tcltk_formula in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do + # tcl-tk is 9.0. It's supported in CPython since 3.14.0a1 (gh-124111) but is not officially supported as of 3.14.0, + # as of 3.15.0rc3, there are still test failures. + # So we prefer 8. + if [[ -n $PYTHON_BUILD_TCLTK_FORMULA ]]; then + export PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA="${PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA:-$PYTHON_BUILD_TCLTK_FORMULA}" + echo "warning: the PYTHON_BUILD_TCLTK_FORMULA envvar has been renamed to PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA" >&2 + fi + for tcltk_formula in ${PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do local tcltk_prefix="$(brew --prefix "${tcltk_formula}" 2>/dev/null || true)" if [ -d "$tcltk_prefix" ]; then echo "python-build: use ${tcltk_formula} from homebrew" diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index 9003f78f..959a27dc 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -1066,8 +1066,10 @@ make install OUT } -@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" { +test_tcltk_var() { + local var="${1:?}" cached_tarball "Python-3.6.2" + stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}" stub uname '-s : echo Darwin' @@ -1080,7 +1082,7 @@ OUT stub_make_install run_inline_definition <