Prefer tcl-tk@8 from Homebrew

Since 10.11.2024, Homebrew upgraded tck-tk to 9.0
which CPython is not compatible with yet
This commit is contained in:
Ivan Pozdeev 2024-12-04 02:19:23 +03:00
parent 0f8b2b2b84
commit 75358a2ce5

View File

@ -1671,8 +1671,12 @@ use_xcode_sdk_zlib() {
use_homebrew_tcltk() { use_homebrew_tcltk() {
can_use_homebrew || return 1 can_use_homebrew || return 1
# get the version from the folder that homebrew versions # Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024),
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)" # tcl-tk is 9.0 which is not compatible with CPython as of this writing
# but we'll keep it as backup for cases like non-updated Homebrew
local tcltk
for tcltk in "tcl-tk@8" "tcl-tk"; do
local tcltk_libdir="$(brew --prefix "${tcltk}" 2>/dev/null || true)"
if [ -d "$tcltk_libdir" ]; then if [ -d "$tcltk_libdir" ]; then
echo "python-build: use tcl-tk from homebrew" echo "python-build: use tcl-tk from homebrew"
if [[ -z "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then if [[ -z "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then
@ -1689,7 +1693,10 @@ use_homebrew_tcltk() {
fi fi
fi fi
export PKG_CONFIG_PATH="${tcltk_libdir}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" export PKG_CONFIG_PATH="${tcltk_libdir}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
return
fi fi
done
return 1
} }
# FIXME: this function is a workaround for #1125 # FIXME: this function is a workaround for #1125