mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2026-09-10 07:16:18 -04:00
For broken .python-version symlinks, remember them but keep going
This commit is contained in:
parent
8546b11429
commit
6d048007e8
|
|
@ -158,12 +158,15 @@ function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||||
set -l _pvh_found_local 0
|
set -l _pvh_found_local 0
|
||||||
set -g _PYENV_VH_PATHS
|
set -g _PYENV_VH_PATHS
|
||||||
while true
|
while true
|
||||||
if test -e "\$d/.python-version"; or test -L "\$d/.python-version"
|
if test -f "\$d/.python-version"; or test -L "\$d/.python-version"
|
||||||
set -g _PYENV_VH_PATHS \$_PYENV_VH_PATHS "\$d/.python-version"
|
set -g _PYENV_VH_PATHS \$_PYENV_VH_PATHS "\$d/.python-version"
|
||||||
set _pvh_found_local 1
|
if test -f "\$d/.python-version"
|
||||||
break
|
set _pvh_found_local 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
else
|
||||||
|
set -g _PYENV_VH_PATHS \$_PYENV_VH_PATHS "\$d"
|
||||||
end
|
end
|
||||||
set -g _PYENV_VH_PATHS \$_PYENV_VH_PATHS "\$d"
|
|
||||||
test "\$d" = "/"; and break
|
test "\$d" = "/"; and break
|
||||||
set d (string replace -r '/[^/]*\$' '' -- "\$d")
|
set d (string replace -r '/[^/]*\$' '' -- "\$d")
|
||||||
test -z "\$d"; and set d "/"
|
test -z "\$d"; and set d "/"
|
||||||
|
|
@ -226,12 +229,15 @@ EOS
|
||||||
local _pvh_d="\${PWD}" _pvh_found_local=0
|
local _pvh_d="\${PWD}" _pvh_found_local=0
|
||||||
_PYENV_VH_PATHS=()
|
_PYENV_VH_PATHS=()
|
||||||
while :; do
|
while :; do
|
||||||
if [ -e "\${_pvh_d}/.python-version" ] || [ -L "\${_pvh_d}/.python-version" ]; then
|
if [ -f "\${_pvh_d}/.python-version" ] || [ -L "\${_pvh_d}/.python-version" ]; then
|
||||||
_PYENV_VH_PATHS+=("\${_pvh_d}/.python-version")
|
_PYENV_VH_PATHS+=("\${_pvh_d}/.python-version")
|
||||||
_pvh_found_local=1
|
if [ -f "\${_pvh_d}/.python-version" ]; then
|
||||||
break
|
_pvh_found_local=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_PYENV_VH_PATHS+=("\${_pvh_d}")
|
||||||
fi
|
fi
|
||||||
_PYENV_VH_PATHS+=("\${_pvh_d}")
|
|
||||||
[ "\${_pvh_d}" = "/" ] && break
|
[ "\${_pvh_d}" = "/" ] && break
|
||||||
_pvh_d="\${_pvh_d%/*}"
|
_pvh_d="\${_pvh_d%/*}"
|
||||||
[ -z "\${_pvh_d}" ] && _pvh_d="/"
|
[ -z "\${_pvh_d}" ] && _pvh_d="/"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue