mirror of
https://github.com/apisnetworks/pyenv.git
synced 2026-11-30 19:59:01 +00:00
Only use -f whenever there's an unquoted word split where globbing is undesired --------- Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
26 lines
643 B
Bash
Executable File
26 lines
643 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Summary: Explain how the current Python version is set
|
|
set -euo pipefail
|
|
[ -n "${PYENV_DEBUG:-}" ] && set -x
|
|
|
|
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
|
|
echo "PYENV_VERSION environment variable"
|
|
else
|
|
pyenv-version-file
|
|
fi
|