mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-08 11:33:49 -05:00
Add PYTHON_BUILD_TCLTK_FORMULA to allow building against Tcl/Tk 9
Tcl/Tk 9.0 support was added in 3.13.0b3 and is not official as of 3.14.0; the build with Homebrew version fails as of this writing
This commit is contained in:
@@ -175,6 +175,7 @@ You can set certain environment variables to control the build process.
|
||||
* `PYTHON_BUILD_SKIP_HOMEBREW`, if set, will not search for libraries installed by Homebrew when it would normally will.
|
||||
* `PYTHON_BUILD_USE_HOMEBREW`, if set, will search for libraries installed by Homebrew when it would normally not.
|
||||
* `PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA`, override the Homebrew OpenSSL formula to use.
|
||||
* `PYTHON_BUILD_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 would normally will.
|
||||
* `PYTHON_BUILD_USE_MACPORTS`, if set, will search for libraries installed by MacPorts when it would normally not.
|
||||
* `PYTHON_BUILD_ROOT` overrides the default location from where build definitions
|
||||
|
||||
@@ -1884,7 +1884,7 @@ use_homebrew_tcltk() {
|
||||
# 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
|
||||
for tcltk in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
|
||||
local tcltk_libdir="$(brew --prefix "${tcltk}" 2>/dev/null || true)"
|
||||
if [ -d "$tcltk_libdir" ]; then
|
||||
echo "python-build: use tcl-tk from homebrew"
|
||||
|
||||
@@ -46,7 +46,7 @@ tarball() {
|
||||
#!$BASH
|
||||
echo "$name: CFLAGS=\\"\$CFLAGS\\" CPPFLAGS=\\"\$CPPFLAGS\\" LDFLAGS=\\"\$LDFLAGS\\" PKG_CONFIG_PATH=\\"\$PKG_CONFIG_PATH\\"" >> build.log
|
||||
echo "$name:" "\$@" \${PYTHONOPT:+PYTHONOPT=\$PYTHONOPT} >> build.log
|
||||
${extra_vars:+echo \"$name: $extra_vars\" >>build.log}
|
||||
${extra_vars:+echo $name: $extra_vars >>build.log}
|
||||
OUT
|
||||
|
||||
for file; do
|
||||
@@ -794,6 +794,40 @@ make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
tcl_tk_version=8.6
|
||||
tcl_tk_libdir="$BATS_TEST_TMPDIR/homebrew-tcl-tk"
|
||||
mkdir -p "$tcl_tk_libdir/lib"
|
||||
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
|
||||
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 1010'
|
||||
|
||||
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-custom
|
||||
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
|
||||
DEF
|
||||
assert_success
|
||||
|
||||
unstub uname
|
||||
unstub sw_vers
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib" PKG_CONFIG_PATH="${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib/pkgconfig"
|
||||
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib --with-tcltk-includes=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "tcl-tk is linked from Homebrew via pkg-config and override vars" {
|
||||
cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS
|
||||
tcl_tk_version=8.6
|
||||
|
||||
Reference in New Issue
Block a user