Kaynağa Gözat

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

pull/413/head
Ville Skyttä 2 yıl önce
işlemeyi yapan: GitHub
ebeveyn
işleme
91609e25f3
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: 4AEE18F83AFDEB23
1 değiştirilmiş dosya ile 9 ekleme ve 6 silme
  1. +9
    -6
      bin/pyenv-sh-activate

+ 9
- 6
bin/pyenv-sh-activate Dosyayı Görüntüle

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

Yükleniyor…
İptal
Kaydet