File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,14 @@ regex="${PYENV_ROOT}/versions/(.+)/bin/(.+)"
3737
3838for link in " ${links[@]} " ; do
3939 # `$link` is the `python` symlink, and `$target` is its target.
40+ linkpath=$( realpath -s " $link " )
4041 target=$( readlink -f " $link " )
41- # Ignore symlinks inside $PYENV_ROOT itself
42- if realpath -s " $link " | grep -v -q " $PYENV_ROOT " ; then
43- [[ " $target " =~ $regex ]]
44- version=" ${BASH_REMATCH[1]} "
42+ [[ " $target " =~ $regex ]]
43+ version=" ${BASH_REMATCH[1]} "
44+ # Only capture links outside PYENV_ROOT or inside pyenv-virtualenv venvs
45+ if grep -v -q " $PYENV_ROOT " <<< " $linkpath" || \
46+ grep -q " $PYENV_ROOT /versions/$version /envs" <<< " $linkpath"
47+ then
4548 echo " $version " :" ${link%/ bin/ python} "
4649 fi
4750done | sort | $output
You can’t perform that action at this time.
0 commit comments