mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
83e5459cfb
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
39 lines
1.1 KiB
Text
Executable file
39 lines
1.1 KiB
Text
Executable file
# Summary: Set or show the global Python version
|
|
#
|
|
# Usage: pyenv global <version>
|
|
#
|
|
# Sets the global Python version. You can override the global version at
|
|
# any time by setting a directory-specific version with `pyenv local'
|
|
# or by setting the `PYENV_VERSION' environment variable.
|
|
#
|
|
# <version> should be a string matching a Python version known to pyenv.
|
|
# The special version string `system' will use your default system Python.
|
|
# Run `pyenv versions' for a list of available Python versions.
|
|
|
|
set -e
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
# Provide pyenv completions
|
|
if [ "$1" = "--complete" ]; then
|
|
echo system
|
|
exec pyenv-versions --bare
|
|
fi
|
|
|
|
versions=("$@")
|
|
PYENV_VERSION_FILE="${PYENV_ROOT}/version"
|
|
|
|
if [ -n "$versions" ]; then
|
|
pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
|
|
else
|
|
OLDIFS="$IFS"
|
|
IFS=: versions=($(
|
|
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
|
|
pyenv-version-file-read "${PYENV_ROOT}/global" ||
|
|
pyenv-version-file-read "${PYENV_ROOT}/default" ||
|
|
echo system
|
|
))
|
|
IFS="$OLDIFS"
|
|
for version in "${versions[@]}"; do
|
|
echo "$version"
|
|
done
|
|
fi
|