Rename PYTHON_BUILD_TCLTK_FORMULA to PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA; deprecate the old name (#3580)

* Update tcl/tk note
This commit is contained in:
native-api 2026-10-03 18:51:15 +03:00 committed by GitHub
parent 67cfc116b9
commit f9d17bfc06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 6 deletions

View File

@ -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_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_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_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_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_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 * `PYTHON_BUILD_ROOT` overrides the default location from where build definitions

View File

@ -2006,9 +2006,14 @@ use_homebrew_tcltk() {
can_use_homebrew || return 1 can_use_homebrew || return 1
local tcltk_formula local tcltk_formula
# Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024), # 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 # 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 # as of 3.15.0rc3, there are still test failures.
for tcltk_formula in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do # 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)" local tcltk_prefix="$(brew --prefix "${tcltk_formula}" 2>/dev/null || true)"
if [ -d "$tcltk_prefix" ]; then if [ -d "$tcltk_prefix" ]; then
echo "python-build: use ${tcltk_formula} from homebrew" echo "python-build: use ${tcltk_formula} from homebrew"

View File

@ -1066,8 +1066,10 @@ make install
OUT 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" cached_tarball "Python-3.6.2"
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}" stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
@ -1080,7 +1082,7 @@ OUT
stub_make_install stub_make_install
run_inline_definition <<DEF run_inline_definition <<DEF
PYTHON_BUILD_TCLTK_FORMULA=tcl-tk-custom $var=tcl-tk-custom
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz" install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF DEF
assert_success assert_success
@ -1098,6 +1100,34 @@ make install
OUT OUT
} }
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA" {
test_tcltk_var PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA
}
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" {
test_tcltk_var PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA
}
@test "PYTHON_BUILD_TCLTK_FORMULA produces a deprecation warning" {
cached_tarball "Python-3.6.2"
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 1010'
stub brew '--prefix openssl : false'
stub brew "--prefix tcl-tk-custom : echo '$tcl_tk_libdir'"
for i in {1..4}; do stub brew false; done
stub_make_install
run_inline_definition <<DEF
PYTHON_BUILD_TCLTK_FORMULA=tcl-tk-whatever
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF
assert_success
assert_line "warning: the PYTHON_BUILD_TCLTK_FORMULA envvar has been renamed to PYTHON_BUILD_HOMEBREW_TCLTK_FORMULA"
}
@test "tcl-tk is linked from Homebrew via pkg-config and override vars" { @test "tcl-tk is linked from Homebrew via pkg-config and override vars" {
cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}" stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"