Bläddra i källkod

perf(sh-activate): avoid a duplicate pyenv-version-name call (#380)

pull/413/head
Ville Skyttä 2 år sedan
committed by GitHub
förälder
incheckning
91609e25f3
Ingen känd nyckel hittad för denna signaturen i databasen GPG-nyckel ID: 4AEE18F83AFDEB23
1 ändrade filer med 9 tillägg och 6 borttagningar
  1. +9
    -6
      bin/pyenv-sh-activate

+ 9
- 6
bin/pyenv-sh-activate Visa fil

@ -52,13 +52,18 @@ while [ $# -gt 0 ]; do
shift 1
done
get_current_versions() {
local IFS=:
current_versions=($(pyenv-version-name 2>/dev/null))
}
no_shell=
versions=("$@")
current_versions=()
if [ -z "${versions}" ]; then
no_shell=1
OLDIFS="$IFS"
IFS=: versions=($(pyenv-version-name 2>/dev/null))
IFS="$OLDIFS"
get_current_versions
versions=("${current_versions[@]}")
fi
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
@ -84,9 +89,7 @@ fi
if ! pyenv-virtualenv-prefix "${venv}" 1>/dev/null 2>&1; then
# fallback to virtualenv of current version
OLDIFS="$IFS"
IFS=: current_versions=($(pyenv-version-name))
IFS="$OLDIFS"
[ -n "${current_versions}" ] || get_current_versions
new_venv="${current_versions%/envs/*}/envs/${venv}"
if pyenv-virtualenv-prefix "${new_venv}" 1>/dev/null 2>&1; then
venv="${new_venv}"

Laddar…
Avbryt
Spara