mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-17 23:26:38 -05:00
Fix pyenv-latest to ignore virtualenvs (#2608)
* Add test, exclude alphas as well
This commit is contained in:
parent
76e93b073e
commit
368e04f3fa
2 changed files with 21 additions and 1 deletions
|
@ -48,9 +48,10 @@ IFS=$'\n'
|
|||
$(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \
|
||||
grep -Ee "^$prefix_re[-.]" || true))
|
||||
|
||||
#FIXME: <version>/envs/<virtualenv> should be excluded in Pyenv-Virtualenv via a hook
|
||||
DEFINITION_CANDIDATES=(\
|
||||
$(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \
|
||||
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(b|rc)[0-9]+$/d'));
|
||||
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(a|b|rc)[0-9]+$/d' -e '/\/envs\//d'));
|
||||
|
||||
# Compose a sorting key, followed by | and original value
|
||||
DEFINITION_CANDIDATES=(\
|
||||
|
|
|
@ -93,3 +93,22 @@ echo 3.10.6
|
|||
3.10.8
|
||||
!
|
||||
}
|
||||
|
||||
@test "ignores rolling releases, branch tips, alternative srcs, prereleases and virtualenvs" {
|
||||
create_executable pyenv-versions <<!
|
||||
#!$BASH
|
||||
echo 3.8.5-dev
|
||||
echo 3.8.5-src
|
||||
echo 3.8.5-latest
|
||||
echo 3.8.5a2
|
||||
echo 3.8.5b3
|
||||
echo 3.8.5rc2
|
||||
echo 3.8.1
|
||||
echo 3.8.1/envs/foo
|
||||
!
|
||||
run pyenv-latest 3.8
|
||||
assert_success
|
||||
assert_output <<!
|
||||
3.8.1
|
||||
!
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue