mirror of
https://github.com/pyenv/pyenv.git
synced 2025-12-06 18:08:37 +00:00
Compare commits
3 Commits
417cd1e6e4
...
76bc459631
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76bc459631 | ||
|
|
2afd1733a4 | ||
|
|
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
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
case "$(anaconda_architecture 2>/dev/null || true)" in
|
||||||
|
"Linux-aarch64" )
|
||||||
|
install_script "Miniconda3-py310_25.9.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_25.9.1-1-Linux-aarch64.sh#28fc3db9c7ee63cedab38b0e6006409f1f448be7ffc57b270623efd4422b0608" "miniconda" verify_py310
|
||||||
|
;;
|
||||||
|
"Linux-x86_64" )
|
||||||
|
install_script "Miniconda3-py310_25.9.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_25.9.1-1-Linux-x86_64.sh#04a8b03d8b0ec062d923e592201a6fd88b7247c309ef8848afb25c424c40ac39" "miniconda" verify_py310
|
||||||
|
;;
|
||||||
|
"MacOSX-arm64" )
|
||||||
|
install_script "Miniconda3-py310_25.9.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_25.9.1-1-MacOSX-arm64.sh#fb3fbef60259b36b0248c73fecdd974f8554d5fccfe0a7b8a45eb06dedbe8a85" "miniconda" verify_py310
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
{ echo
|
||||||
|
colorize 1 "ERROR"
|
||||||
|
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
case "$(anaconda_architecture 2>/dev/null || true)" in
|
||||||
|
"Linux-aarch64" )
|
||||||
|
install_script "Miniconda3-py311_25.9.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_25.9.1-1-Linux-aarch64.sh#4e0723b9d76aa491cf22511dac36f4fdec373e41d2a243ff875e19b8df39bf94" "miniconda" verify_py311
|
||||||
|
;;
|
||||||
|
"Linux-x86_64" )
|
||||||
|
install_script "Miniconda3-py311_25.9.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_25.9.1-1-Linux-x86_64.sh#238abad23f8d4d8ba89dd05df0b0079e278909a36e06955f12bbef4aa94e6131" "miniconda" verify_py311
|
||||||
|
;;
|
||||||
|
"MacOSX-arm64" )
|
||||||
|
install_script "Miniconda3-py311_25.9.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py311_25.9.1-1-MacOSX-arm64.sh#5d5f58477f40d23e491394a7114a318724f1f9161e2b8bd08c5845c47b036b72" "miniconda" verify_py311
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
{ echo
|
||||||
|
colorize 1 "ERROR"
|
||||||
|
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
case "$(anaconda_architecture 2>/dev/null || true)" in
|
||||||
|
"Linux-aarch64" )
|
||||||
|
install_script "Miniconda3-py312_25.9.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_25.9.1-1-Linux-aarch64.sh#11ab86931679e6d9b15112f2e866dad1fcbd89a039a6442c0bce7b86fd282f0a" "miniconda" verify_py312
|
||||||
|
;;
|
||||||
|
"Linux-x86_64" )
|
||||||
|
install_script "Miniconda3-py312_25.9.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_25.9.1-1-Linux-x86_64.sh#a0def9c732d94b156529ef7db8edd6e1862cee784a27a4961870dca86e89fba4" "miniconda" verify_py312
|
||||||
|
;;
|
||||||
|
"MacOSX-arm64" )
|
||||||
|
install_script "Miniconda3-py312_25.9.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py312_25.9.1-1-MacOSX-arm64.sh#6bf3d8cac26587f6e53f05cd781f9201d2918c37dc3ef20677b383e250568100" "miniconda" verify_py312
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
{ echo
|
||||||
|
colorize 1 "ERROR"
|
||||||
|
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
case "$(anaconda_architecture 2>/dev/null || true)" in
|
||||||
|
"Linux-aarch64" )
|
||||||
|
install_script "Miniconda3-py313_25.9.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_25.9.1-1-Linux-aarch64.sh#a0de4562c368a8b5ca4385843f405684c79bea7aa3b75d7513ff99c0c6435d51" "miniconda" verify_py313
|
||||||
|
;;
|
||||||
|
"Linux-x86_64" )
|
||||||
|
install_script "Miniconda3-py313_25.9.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_25.9.1-1-Linux-x86_64.sh#6022714da22986097bbefa13dab3d957257fef04e1c37d1ebd3645b5b99bc9d4" "miniconda" verify_py313
|
||||||
|
;;
|
||||||
|
"MacOSX-arm64" )
|
||||||
|
install_script "Miniconda3-py313_25.9.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py313_25.9.1-1-MacOSX-arm64.sh#491f35ab841c99225e5680209d5455a2f5278551378781c0dfeaf2586d7ae3df" "miniconda" verify_py313
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
{ echo
|
||||||
|
colorize 1 "ERROR"
|
||||||
|
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
case "$(anaconda_architecture 2>/dev/null || true)" in
|
||||||
|
"Linux-aarch64" )
|
||||||
|
install_script "Miniconda3-py39_25.9.1-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_25.9.1-1-Linux-aarch64.sh#983ef280dec1d0f965b6b6133c585ce902e07136105d4977aa5de3aa027cfa55" "miniconda" verify_py39
|
||||||
|
;;
|
||||||
|
"Linux-x86_64" )
|
||||||
|
install_script "Miniconda3-py39_25.9.1-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_25.9.1-1-Linux-x86_64.sh#d8d13344b46a057659397b9ca1a948d184bf59f04efa8864df8c01f7557e2baa" "miniconda" verify_py39
|
||||||
|
;;
|
||||||
|
"MacOSX-arm64" )
|
||||||
|
install_script "Miniconda3-py39_25.9.1-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_25.9.1-1-MacOSX-arm64.sh#857f09c2be8feaf3664064a2e324e96656104a9a45ab0a657a49c03754855b77" "miniconda" verify_py39
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
{ echo
|
||||||
|
colorize 1 "ERROR"
|
||||||
|
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -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