mirror of
https://github.com/pyenv/pyenv.git
synced 2025-12-06 18:08:37 +00:00
Compare commits
3 Commits
e48951db1a
...
1f0f245757
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f0f245757 | ||
|
|
8d3bba2f92 | ||
|
|
715c939abf |
@ -76,23 +76,27 @@ export PYENV_DIR
|
|||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
bin_path="$(abs_dirname "$0")"
|
PYENV_INSTALL_PATH="$(abs_dirname "$0")"
|
||||||
for plugin_bin in "${bin_path%/*}"/plugins/*/bin; do
|
PYENV_INSTALL_PATH="${PYENV_INSTALL_PATH%/*}"
|
||||||
|
|
||||||
|
export PYENV_INSTALL_PATH
|
||||||
|
|
||||||
|
for plugin_bin in "${PYENV_INSTALL_PATH}"/plugins/*/bin; do
|
||||||
PATH="${plugin_bin}:${PATH}"
|
PATH="${plugin_bin}:${PATH}"
|
||||||
done
|
done
|
||||||
# PYENV_ROOT can be set to anything, so it may happen to be equal to the base path above,
|
# PYENV_ROOT can be set to anything, so it may happen to be equal to the base path above,
|
||||||
# resulting in duplicate PATH entries
|
# resulting in duplicate PATH entries
|
||||||
if [ "${bin_path%/*}" != "$PYENV_ROOT" ]; then
|
if [ "${PYENV_INSTALL_PATH}" != "$PYENV_ROOT" ]; then
|
||||||
for plugin_bin in "${PYENV_ROOT}"/plugins/*/bin; do
|
for plugin_bin in "${PYENV_ROOT}"/plugins/*/bin; do
|
||||||
PATH="${plugin_bin}:${PATH}"
|
PATH="${plugin_bin}:${PATH}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
export PATH="${bin_path}:${PATH}"
|
export PATH="${PYENV_INSTALL_PATH}/libexec:${PATH}"
|
||||||
|
|
||||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d"
|
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d"
|
||||||
if [ "${bin_path%/*}" != "$PYENV_ROOT" ]; then
|
if [ "${PYENV_INSTALL_PATH}" != "$PYENV_ROOT" ]; then
|
||||||
# Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT
|
# Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT
|
||||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${bin_path%/*}/pyenv.d"
|
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_INSTALL_PATH}/pyenv.d"
|
||||||
fi
|
fi
|
||||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/etc/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
|
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/etc/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
|
||||||
for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do
|
for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do
|
||||||
|
|||||||
@ -31,6 +31,7 @@ fi
|
|||||||
|
|
||||||
PYENV_COMMAND_PATH="$(pyenv-which "$PYENV_COMMAND")"
|
PYENV_COMMAND_PATH="$(pyenv-which "$PYENV_COMMAND")"
|
||||||
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
|
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
|
||||||
|
|
||||||
export PYENV_VERSION
|
export PYENV_VERSION
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
OLDIFS="$IFS"
|
||||||
|
|||||||
@ -241,7 +241,7 @@ function print_env() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function print_completion() {
|
function print_completion() {
|
||||||
completion="${0%/*/*}/completions/pyenv.${shell}"
|
completion="${PYENV_INSTALL_PATH}/completions/pyenv.${shell}"
|
||||||
if [ -r "$completion" ]; then
|
if [ -r "$completion" ]; then
|
||||||
echo "source '$completion'"
|
echo "source '$completion'"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -256,7 +256,6 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
|
|||||||
# Display a more helpful message if the definition wasn't found.
|
# Display a more helpful message if the definition wasn't found.
|
||||||
if [ "$STATUS" == "2" ]; then
|
if [ "$STATUS" == "2" ]; then
|
||||||
{ candidates="$(definitions "$DEFINITION")"
|
{ candidates="$(definitions "$DEFINITION")"
|
||||||
here="$(dirname "${0%/*}")/../.."
|
|
||||||
if [ -n "$candidates" ]; then
|
if [ -n "$candidates" ]; then
|
||||||
echo
|
echo
|
||||||
echo "The following versions contain \`$DEFINITION' in the name:"
|
echo "The following versions contain \`$DEFINITION' in the name:"
|
||||||
@ -266,12 +265,12 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
|
|||||||
echo "See all available versions with \`pyenv install --list'."
|
echo "See all available versions with \`pyenv install --list'."
|
||||||
echo
|
echo
|
||||||
echo -n "If the version you need is missing, try upgrading pyenv"
|
echo -n "If the version you need is missing, try upgrading pyenv"
|
||||||
if [ "$here" != "${here#$(brew --prefix 2>/dev/null)}" ]; then
|
if [ "${PYENV_INSTALL_PATH}" != "${PYENV_INSTALL_PATH#$(brew --prefix 2>/dev/null)}" ]; then
|
||||||
printf ":\n\n"
|
printf ":\n\n"
|
||||||
echo " brew update && brew upgrade pyenv"
|
echo " brew update && brew upgrade pyenv"
|
||||||
elif [ -d "${here}/.git" ]; then
|
elif [ -d "${PYENV_INSTALL_PATH}/.git" ]; then
|
||||||
printf ":\n\n"
|
printf ":\n\n"
|
||||||
echo " cd ${here} && git pull && cd -"
|
echo " cd ${PYENV_INSTALL_PATH} && git pull && cd -"
|
||||||
else
|
else
|
||||||
printf ".\n"
|
printf ".\n"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1880,26 +1880,24 @@ use_macports_zlib() {
|
|||||||
|
|
||||||
use_homebrew_tcltk() {
|
use_homebrew_tcltk() {
|
||||||
can_use_homebrew || return 1
|
can_use_homebrew || return 1
|
||||||
|
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 which is not compatible with CPython as of this writing
|
# 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
|
||||||
# but we'll keep it as backup for cases like non-updated Homebrew
|
# so we prefer 8
|
||||||
local tcltk
|
for tcltk_formula in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
|
||||||
for tcltk in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do
|
local tcltk_prefix="$(brew --prefix "${tcltk_formula}" 2>/dev/null || true)"
|
||||||
local tcltk_libdir="$(brew --prefix "${tcltk}" 2>/dev/null || true)"
|
if [ -d "$tcltk_prefix" ]; then
|
||||||
if [ -d "$tcltk_libdir" ]; then
|
echo "python-build: use ${tcltk_formula} from homebrew"
|
||||||
echo "python-build: use tcl-tk from homebrew"
|
|
||||||
local tcltk_version="$(sh -c '. '"$tcltk_libdir"'/lib/tclConfig.sh; echo $TCL_VERSION')"
|
|
||||||
local tcltk_includes tcltk_libs
|
|
||||||
# In Homebrew Tcl/Tk 8.6.13, headers have been moved to the 'tcl-tk' subdir.
|
# In Homebrew Tcl/Tk 8.6.13, headers have been moved to the 'tcl-tk' subdir.
|
||||||
# We're not using tclConfig.sh here 'cuz it produces the version-specific path to <brew prefix>/Cellar
|
local tcltk_includes="$(sh -c 'cd '"$tcltk_prefix"'/lib; . ./tclConfig.sh; . ./tkConfig.sh; echo "$TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"')"
|
||||||
# and we'd rather have rpath set to <brew prefix>/opt/<...> to allow micro release upgrades without rebuilding
|
# Homebrew Tcl/Tk 9 is built with external libtommath. CPython's build as of 3.14.0 does not detect that and fails to link to tommath symbols
|
||||||
# XXX: do use tclConfig.sh and translate the paths if more shenanigans appear in later releases
|
local tcltk_cflags
|
||||||
if [ -d "$tcltk_libdir/include/tcl-tk" ]; then
|
if sh -c '. '"$tcltk_prefix"'/lib/tclConfig.sh; echo "$TCL_DEFS"' | grep -qwFe '-DTCL_WITH_EXTERNAL_TOMMATH=1'; then
|
||||||
tcltk_includes="-I$tcltk_libdir/include/tcl-tk"
|
tcltk_cflags="-DTCL_WITH_EXTERNAL_TOMMATH=1"
|
||||||
else
|
|
||||||
tcltk_includes="-I$tcltk_libdir/include"
|
|
||||||
fi
|
fi
|
||||||
tcltk_libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version"
|
# For some reason, keg-only tcl-tk@8 successfully links with Tkinter without specifying rpath, with `/opt' rpath
|
||||||
|
# so no need to translate /Cellar path to /opt path
|
||||||
|
local tcltk_libs="$(sh -c 'cd '"$tcltk_prefix"'/lib; . ./tclConfig.sh; . ./tkConfig.sh; echo "$TCL_LIB_SPEC $TK_LIB_SPEC"')"
|
||||||
# Since 2.7.6, 3.3.3, 3.4.0 (Issue #1584): --with-tcltk-includes + --with-tcltk-libs Configure options
|
# Since 2.7.6, 3.3.3, 3.4.0 (Issue #1584): --with-tcltk-includes + --with-tcltk-libs Configure options
|
||||||
# Since 3.11.0 (bpo-45847): `pkg-config` call, TCLTK_CFLAGS + TCLTK_LIBS override
|
# Since 3.11.0 (bpo-45847): `pkg-config` call, TCLTK_CFLAGS + TCLTK_LIBS override
|
||||||
if [[ -n "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then
|
if [[ -n "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then
|
||||||
@ -1907,14 +1905,15 @@ use_homebrew_tcltk() {
|
|||||||
# There's no way to provide a fallback only if it's is not present
|
# There's no way to provide a fallback only if it's is not present
|
||||||
# and Configure's logic of detecting if it's present is complicated.
|
# and Configure's logic of detecting if it's present is complicated.
|
||||||
# So we just override it always
|
# So we just override it always
|
||||||
export TCLTK_CFLAGS="$tcltk_includes"
|
export TCLTK_CFLAGS="$tcltk_includes${tcltk_cflags:+ $tcltk_cflags}"
|
||||||
export TCLTK_LIBS="$tcltk_libs"
|
export TCLTK_LIBS="$tcltk_libs"
|
||||||
else
|
else
|
||||||
package_option python configure --with-tcltk-includes="$tcltk_includes"
|
package_option python configure --with-tcltk-includes="$tcltk_includes"
|
||||||
package_option python configure --with-tcltk-libs="$tcltk_libs"
|
package_option python configure --with-tcltk-libs="$tcltk_libs"
|
||||||
|
[[ -n $tcltk_cflags ]] && export CFLAGS="${tcltk_cflags}${CFLAGS:+ $CFLAGS}"
|
||||||
fi
|
fi
|
||||||
#set in either case as a failsafe
|
#set in either case as a failsafe
|
||||||
export PKG_CONFIG_PATH="${tcltk_libdir}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
export PKG_CONFIG_PATH="${tcltk_prefix}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
|
||||||
|
|
||||||
lock_in homebrew
|
lock_in homebrew
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -68,6 +68,20 @@ assert_build_log() {
|
|||||||
assert_output
|
assert_output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stub_tcltk() {
|
||||||
|
local tcltk_prefix="${1:?}"
|
||||||
|
mkdir -p "$tcltk_prefix/lib"
|
||||||
|
cat >"$tcltk_prefix/lib/tclConfig.sh" <<!
|
||||||
|
TCL_INCLUDE_SPEC='-I${tcltk_prefix}/include'
|
||||||
|
TCL_LIB_SPEC='-L${tcltk_prefix}/lib -ltclX.Y'
|
||||||
|
!
|
||||||
|
cat >"$tcltk_prefix/lib/tkConfig.sh" <<!
|
||||||
|
TK_INCLUDE_SPEC='-I${tcltk_prefix}/include'
|
||||||
|
TK_LIB_SPEC='-L${tcltk_prefix}/lib -ltkX.Y'
|
||||||
|
!
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@test "yaml is installed for python" {
|
@test "yaml is installed for python" {
|
||||||
cached_tarball "yaml-0.1.6"
|
cached_tarball "yaml-0.1.6"
|
||||||
cached_tarball "Python-3.6.2"
|
cached_tarball "Python-3.6.2"
|
||||||
@ -216,11 +230,11 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.
|
|||||||
DEF
|
DEF
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
unstub uname
|
# unstub uname
|
||||||
unstub sw_vers
|
# unstub sw_vers
|
||||||
unstub brew
|
# unstub brew
|
||||||
unstub port
|
# unstub port
|
||||||
unstub make
|
# unstub make
|
||||||
|
|
||||||
assert_build_log <<OUT
|
assert_build_log <<OUT
|
||||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
|
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${BATS_TEST_TMPDIR}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${BATS_TEST_TMPDIR}/install/lib -Wl,-rpath,${BATS_TEST_TMPDIR}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||||
@ -763,10 +777,7 @@ OUT
|
|||||||
|
|
||||||
@test "tcl-tk is linked from Homebrew via --with-tcl-*" {
|
@test "tcl-tk is linked from Homebrew via --with-tcl-*" {
|
||||||
cached_tarball "Python-3.6.2"
|
cached_tarball "Python-3.6.2"
|
||||||
tcl_tk_version=8.6
|
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||||
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 uname '-s : echo Darwin'
|
||||||
stub sw_vers '-productVersion : echo 1010'
|
stub sw_vers '-productVersion : echo 1010'
|
||||||
@ -788,7 +799,40 @@ DEF
|
|||||||
|
|
||||||
assert_build_log <<OUT
|
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: 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
|
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 -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "tcl-tk with external libtommath is linked from Homebrew via --with-tcl-*" {
|
||||||
|
cached_tarball "Python-3.6.2"
|
||||||
|
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||||
|
cat >>"$tcl_tk_libdir/lib/tclConfig.sh" <<!
|
||||||
|
TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
|
||||||
|
!
|
||||||
|
|
||||||
|
stub uname '-s : echo Darwin'
|
||||||
|
stub sw_vers '-productVersion : echo 1010'
|
||||||
|
|
||||||
|
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
|
||||||
|
for i in {1..4}; do stub brew false; done
|
||||||
|
|
||||||
|
stub_make_install
|
||||||
|
|
||||||
|
run_inline_definition <<DEF
|
||||||
|
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="-DTCL_WITH_EXTERNAL_TOMMATH=1" 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 -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||||
make -j 2
|
make -j 2
|
||||||
make install
|
make install
|
||||||
OUT
|
OUT
|
||||||
@ -796,10 +840,7 @@ OUT
|
|||||||
|
|
||||||
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" {
|
@test "tcl-tk is linked from Homebrew with PYTHON_BUILD_TCLTK_FORMULA" {
|
||||||
cached_tarball "Python-3.6.2"
|
cached_tarball "Python-3.6.2"
|
||||||
tcl_tk_version=8.6
|
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||||
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 uname '-s : echo Darwin'
|
||||||
stub sw_vers '-productVersion : echo 1010'
|
stub sw_vers '-productVersion : echo 1010'
|
||||||
@ -822,7 +863,7 @@ DEF
|
|||||||
|
|
||||||
assert_build_log <<OUT
|
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: 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
|
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 -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include --with-tcltk-libs=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||||
make -j 2
|
make -j 2
|
||||||
make install
|
make install
|
||||||
OUT
|
OUT
|
||||||
@ -830,10 +871,7 @@ OUT
|
|||||||
|
|
||||||
@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
|
||||||
tcl_tk_version=8.6
|
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||||
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 uname '-s : echo Darwin'
|
||||||
stub sw_vers '-productVersion : echo 1010'
|
stub sw_vers '-productVersion : echo 1010'
|
||||||
@ -857,7 +895,42 @@ DEF
|
|||||||
assert_build_log <<OUT
|
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: 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
|
Python-3.6.2: --prefix=${BATS_TEST_TMPDIR}/install --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||||
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version
|
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "tcl-tk with external libtommath is linked from Homebrew via pkg-config and override vars" {
|
||||||
|
cached_tarball "Python-3.6.2" - TCLTK_CFLAGS TCLTK_LIBS
|
||||||
|
stub_tcltk "${tcl_tk_libdir:=$BATS_TEST_TMPDIR/homebrew-tcl-tk}"
|
||||||
|
cat >>"$tcl_tk_libdir/lib/tclConfig.sh" <<!
|
||||||
|
TCL_DEFS='-DSMTH -DTCL_WITH_EXTERNAL_TOMMATH=1 -DSMTH_ELSE'
|
||||||
|
!
|
||||||
|
|
||||||
|
stub uname '-s : echo Darwin'
|
||||||
|
stub sw_vers '-productVersion : echo 1010'
|
||||||
|
|
||||||
|
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
|
||||||
|
for i in {1..4}; do stub brew false; done
|
||||||
|
|
||||||
|
stub_make_install
|
||||||
|
|
||||||
|
run_inline_definition <<DEF
|
||||||
|
PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
|
||||||
|
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
|
||||||
|
Python-3.6.2: TCLTK_CFLAGS=-I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -I${BATS_TEST_TMPDIR}/homebrew-tcl-tk/include -DTCL_WITH_EXTERNAL_TOMMATH=1 TCLTK_LIBS=-L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltclX.Y -L${BATS_TEST_TMPDIR}/homebrew-tcl-tk/lib -ltkX.Y
|
||||||
make -j 2
|
make -j 2
|
||||||
make install
|
make install
|
||||||
OUT
|
OUT
|
||||||
|
|||||||
@ -140,7 +140,8 @@ OUT
|
|||||||
stub_python_build 'echo ERROR >&2 && exit 2'
|
stub_python_build 'echo ERROR >&2 && exit 2'
|
||||||
stub_python_build "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
|
stub_python_build "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
|
||||||
|
|
||||||
run pyenv-install 2.7.9
|
mkdir "$BATS_TEST_TMPDIR/.git"
|
||||||
|
PYENV_INSTALL_PATH="$BATS_TEST_TMPDIR" run pyenv-install 2.7.9
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
ERROR
|
ERROR
|
||||||
@ -153,19 +154,19 @@ See all available versions with \`pyenv install --list'.
|
|||||||
|
|
||||||
If the version you need is missing, try upgrading pyenv:
|
If the version you need is missing, try upgrading pyenv:
|
||||||
|
|
||||||
cd ${BATS_TEST_DIRNAME}/../../.. && git pull && cd -
|
cd ${BATS_TEST_TMPDIR} && git pull && cd -
|
||||||
OUT
|
OUT
|
||||||
|
|
||||||
unstub python-build
|
unstub python-build
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "homebrew upgrade instructions given when pyenv is homebrew-installed" {
|
@test "homebrew upgrade instructions given when pyenv is homebrew-installed" {
|
||||||
stub brew "--prefix : echo '${BATS_TEST_DIRNAME%/*}'"
|
stub brew "--prefix : echo '${BATS_TEST_TMPDIR}'"
|
||||||
stub_python_build_lib
|
stub_python_build_lib
|
||||||
stub_python_build 'echo ERROR >&2 && exit 2' \
|
stub_python_build 'echo ERROR >&2 && exit 2' \
|
||||||
"--definitions : true"
|
"--definitions : true"
|
||||||
|
|
||||||
run pyenv-install 1.9.3
|
PYENV_INSTALL_PATH="$BATS_TEST_TMPDIR" run pyenv-install 1.9.3
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
ERROR
|
ERROR
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
load test_helper
|
load test_helper
|
||||||
|
|
||||||
_setup() {
|
_setup() {
|
||||||
export GIT_DIR="${PYENV_TEST_DIR}/.git"
|
export GIT_DIR="${HOME}/.git"
|
||||||
mkdir -p "$HOME"
|
mkdir -p "$HOME"
|
||||||
git config --global user.name "Tester"
|
git config --global user.name "Tester"
|
||||||
git config --global user.email "tester@test.local"
|
git config --global user.email "tester@test.local"
|
||||||
|
|||||||
@ -37,7 +37,7 @@ create_executable() {
|
|||||||
|
|
||||||
@test "setup shell completions" {
|
@test "setup shell completions" {
|
||||||
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||||
run pyenv-init - bash
|
PYENV_INSTALL_PATH="${exec_root}" run pyenv-init - bash
|
||||||
assert_success
|
assert_success
|
||||||
assert_line "source '${exec_root}/completions/pyenv.bash'"
|
assert_line "source '${exec_root}/completions/pyenv.bash'"
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ OUT
|
|||||||
|
|
||||||
@test "setup shell completions (fish)" {
|
@test "setup shell completions (fish)" {
|
||||||
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||||
run pyenv-init - fish
|
PYENV_INSTALL_PATH="${exec_root}" run pyenv-init - fish
|
||||||
assert_success
|
assert_success
|
||||||
assert_line "source '${exec_root}/completions/pyenv.fish'"
|
assert_line "source '${exec_root}/completions/pyenv.fish'"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ setup() {
|
|||||||
export BATS_TEST_TMPDIR="${bats_test_tmpdir}"
|
export BATS_TEST_TMPDIR="${bats_test_tmpdir}"
|
||||||
export PYENV_TEST_DIR="${BATS_TEST_TMPDIR}/pyenv"
|
export PYENV_TEST_DIR="${BATS_TEST_TMPDIR}/pyenv"
|
||||||
export PYENV_ROOT="${PYENV_TEST_DIR}/root"
|
export PYENV_ROOT="${PYENV_TEST_DIR}/root"
|
||||||
|
export PYENV_INSTALL_PATH="${PYENV_TEST_DIR}"
|
||||||
export HOME="${PYENV_TEST_DIR}/home"
|
export HOME="${PYENV_TEST_DIR}/home"
|
||||||
export PYENV_HOOK_PATH="${PYENV_ROOT}/pyenv.d"
|
export PYENV_HOOK_PATH="${PYENV_ROOT}/pyenv.d"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user