Tolerate nonexistent versions from pyenv-version-name in pyenv-which

Addendum to #3134 as per https://github.com/pyenv/pyenv/pull/3134#issuecomment-2545710044
This commit is contained in:
Ivan Pozdeev 2024-12-16 21:36:14 +03:00
parent dc873cf568
commit 86be59a6d5
2 changed files with 16 additions and 1 deletions

View File

@ -59,7 +59,7 @@ if [ -z "$PYENV_COMMAND" ]; then
fi fi
OLDIFS="$IFS" OLDIFS="$IFS"
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)}) IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name -f)})
IFS="$OLDIFS" IFS="$OLDIFS"
declare -a nonexistent_versions declare -a nonexistent_versions

View File

@ -153,6 +153,21 @@ SH
assert_success "${PYENV_ROOT}/versions/3.4/bin/python" assert_success "${PYENV_ROOT}/versions/3.4/bin/python"
} }
@test "tolerates nonexistent versions from pyenv-version-name" {
mkdir -p "$PYENV_ROOT"
cat > "${PYENV_ROOT}/version" <<EOF
2.7
3.4
EOF
create_executable "3.4" "python"
mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR"
PYENV_VERSION= run pyenv-which python
assert_success "${PYENV_ROOT}/versions/3.4/bin/python"
}
@test "resolves pyenv-latest prefixes" { @test "resolves pyenv-latest prefixes" {
create_executable "3.4.2" "python" create_executable "3.4.2" "python"