Explorar el Código

Support virtualenvs with names starting with "python-" (#3086)

pull/3092/head
Antoine Arbouin hace 1 año
cometido por GitHub
padre
commit
03b60aafec
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: B5690EEEBB952194
Se han modificado 2 ficheros con 12 adiciones y 1 borrados
  1. +5
    -1
      libexec/pyenv-version-name
  2. +7
    -0
      test/version-name.bats

+ 5
- 1
libexec/pyenv-version-name Ver fichero

@ -32,8 +32,12 @@ OLDIFS="$IFS"
for version in ${PYENV_VERSION}; do
# Remove the explicit 'python-' prefix from versions like 'python-3.12'.
normalised_version="${version#python-}"
if version_exists "${normalised_version}" || [ "$version" = "system" ]; then
if version_exists "${version}" || [ "$version" = "system" ]; then
versions=("${versions[@]}" "${version}")
elif version_exists "${normalised_version}"; then
versions=("${versions[@]}" "${normalised_version}")
elif resolved_version="$(pyenv-latest -b "${version}")"; then
versions=("${versions[@]}" "${resolved_version}")
elif resolved_version="$(pyenv-latest -b "${normalised_version}")"; then
versions=("${versions[@]}" "${resolved_version}")
else

+ 7
- 0
test/version-name.bats Ver fichero

@ -127,3 +127,10 @@ OUT
assert_success
assert_output "3.12.6"
}
@test "pyenv version started by python-" {
create_version "python-3.12.6"
PYENV_VERSION="python-3.12.6" run pyenv-version-name
assert_success
assert_output "python-3.12.6"
}

Cargando…
Cancelar
Guardar