pyenv/libexec/pyenv-version-origin
Casey McGinty 83e5459cfb Remove shebang lines from scripts for performance
All scripts in libexec/ (excluding pyenv) are called through pyenv,
therefore the shebang lines are not necessary. On some systems this
provides a measurable increase in performance of the shell prompt.

Related to pyenv/pyenv-virtualenv#259
2019-03-07 22:15:14 +01:00

20 lines
440 B
Text
Executable file

# Summary: Explain how the current Python version is set
set -e
[ -n "$PYENV_DEBUG" ] && set -x
unset PYENV_VERSION_ORIGIN
OLDIFS="$IFS"
IFS=$'\n' scripts=(`pyenv-hooks version-origin`)
IFS="$OLDIFS"
for script in "${scripts[@]}"; do
source "$script"
done
if [ -n "$PYENV_VERSION_ORIGIN" ]; then
echo "$PYENV_VERSION_ORIGIN"
elif [ -n "$PYENV_VERSION" ]; then
echo "PYENV_VERSION environment variable"
else
pyenv-version-file
fi