fix: look for -m followed by pip instead of looking for python -m pip

It isn't necessarily the case that the command will be python, it can be
both python3, python2, python3.12, etc.
This commit is contained in:
Christian Fredrik Johnsen 2024-12-22 13:40:47 +01:00
parent c660839b62
commit 372ffab430

View File

@ -6,9 +6,13 @@ if [[ $PYENV_REHASH_COMMAND =~ ^(pip|easy_install)[23](\.\d)?$ ]]; then
PYENV_REHASH_COMMAND="${BASH_REMATCH[1]}" PYENV_REHASH_COMMAND="${BASH_REMATCH[1]}"
fi fi
if [[ $1 == "python" && $2 == "-m" && $3 == "pip" ]]; then for (( i=1; i<$#; i++ )); do
next=$((i+1))
if [[ ${!i} == "-m" && ${!next} == "pip" ]]; then
PYENV_REHASH_COMMAND="pip" PYENV_REHASH_COMMAND="pip"
break
fi fi
done
if [ -x "${PYENV_PIP_REHASH_ROOT}/${PYENV_REHASH_COMMAND}" ]; then if [ -x "${PYENV_PIP_REHASH_ROOT}/${PYENV_REHASH_COMMAND}" ]; then
PYENV_COMMAND_PATH="${PYENV_PIP_REHASH_ROOT}/${PYENV_REHASH_COMMAND##*/}" PYENV_COMMAND_PATH="${PYENV_PIP_REHASH_ROOT}/${PYENV_REHASH_COMMAND##*/}"