Files
pyenv/libexec/pyenv-version-origin
T

25 lines
643 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2013-01-18 17:41:41 +09:00
# Summary: Explain how the current Python version is set
set -euo pipefail
[ -n "${PYENV_DEBUG:-}" ] && set -x
2012-08-31 15:23:41 +09:00
PYENV_VERSION_ORIGIN=
OLDIFS="$IFS"
IFS=$'\n' scripts=(`pyenv-hooks version-origin`)
IFS="$OLDIFS"
# bash < 4.4 (incl. macOS's 3.2) treats an empty array as unbound under set -u,
# and hooks are third-party code, so relax nounset while sourcing them
set +u
for script in "${scripts[@]}"; do
source "$script"
done
set -u
if [[ -n ${PYENV_VERSION_ORIGIN:-} ]]; then
echo "$PYENV_VERSION_ORIGIN"
elif [[ -n ${PYENV_VERSION:-} ]]; then
2012-08-31 15:23:41 +09:00
echo "PYENV_VERSION environment variable"
else
pyenv-version-file
fi