Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions etc/pyenv.d/which/whence.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
if [ -n "$PYENV_COMMAND" ] && [ ! -x "$PYENV_COMMAND_PATH" ]; then
versions=($(pyenv-whence "${PYENV_COMMAND}" 2>/dev/null || true))
if [ -n "${versions}" ]; then
if [ "${#versions[@]}" -gt 1 ]; then
echo "pyenv-implicit: found multiple ${PYENV_COMMAND} in pyenv. Use version ${versions[0]}." 1>&2
if [ "${#versions[@]}" -gt 2 ]; then
echo "pyenv-implicit1: found multiple ${PYENV_COMMAND} in pyenv. Use version ${versions[0]}." 1>&2
elif [ "${#versions[@]}" -gt 1 ]; then
pattern0="[1-9][0-9]*\.[0-9]*\.[0-9]*/envs/${versions[0]}$"
pattern1="[1-9][0-9]*\.[0-9]*\.[0-9]*/envs/${versions[1]}$"
# Commands in virtualenvs are always listed twice. Ignore this warning if both versions are the same virtualenv
if ! [[ "${versions[0]}" =~ $pattern1 ]] && ! [[ "${versions[1]}" =~ $pattern0 ]]; then
echo "pyenv-implicit2: found multiple ${PYENV_COMMAND} in pyenv. Use version ${versions[0]}." 1>&2
fi
fi
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${versions[0]}/bin/${PYENV_COMMAND}"
fi
Expand Down