mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
s/PYENV_VERSIONS/PYENV_VERSION/ for backward compatibility.
This commit is contained in:
parent
2856f81bb9
commit
dff57ae35d
8 changed files with 44 additions and 44 deletions
|
@ -8,19 +8,19 @@ if [ "$1" = "--complete" ]; then
|
||||||
exec pyenv-versions --bare
|
exec pyenv-versions --bare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYENV_VERSIONS=($@)
|
PYENV_VERSION=($@)
|
||||||
PYENV_VERSION_FILE="${PYENV_ROOT}/version"
|
PYENV_VERSION_FILE="${PYENV_ROOT}/version"
|
||||||
|
|
||||||
if [ -n "$PYENV_VERSIONS" ]; then
|
if [ -n "$PYENV_VERSION" ]; then
|
||||||
pyenv-version-file-write "$PYENV_VERSION_FILE" "${PYENV_VERSIONS[@]}"
|
pyenv-version-file-write "$PYENV_VERSION_FILE" "${PYENV_VERSION[@]}"
|
||||||
else
|
else
|
||||||
IFS=: PYENV_VERSIONS=($(
|
IFS=: PYENV_VERSION=($(
|
||||||
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
|
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
|
||||||
pyenv-version-file-read "${PYENV_ROOT}/global" ||
|
pyenv-version-file-read "${PYENV_ROOT}/global" ||
|
||||||
pyenv-version-file-read "${PYENV_ROOT}/default" ||
|
pyenv-version-file-read "${PYENV_ROOT}/default" ||
|
||||||
echo system
|
echo system
|
||||||
))
|
))
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
echo "$PYENV_VERSION"
|
echo "$version"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -44,7 +44,7 @@ global) echo "usage: pyenv global <version>
|
||||||
|
|
||||||
Sets the global Python version. You can override the global version at
|
Sets the global Python version. You can override the global version at
|
||||||
any time by setting a directory-specific version with \`pyenv local'
|
any time by setting a directory-specific version with \`pyenv local'
|
||||||
or by setting the PYENV_VERSIONS environment variable.
|
or by setting the PYENV_VERSION environment variable.
|
||||||
|
|
||||||
$(print_set_version)"
|
$(print_set_version)"
|
||||||
;;
|
;;
|
||||||
|
@ -58,14 +58,14 @@ When you run a Python command, pyenv will look for an '.pyenv-version'
|
||||||
file in the current directory and each parent directory. If no such
|
file in the current directory and each parent directory. If no such
|
||||||
file is found in the tree, pyenv will use the global Python version
|
file is found in the tree, pyenv will use the global Python version
|
||||||
specified with \`pyenv global', or the version specified in the
|
specified with \`pyenv global', or the version specified in the
|
||||||
PYENV_VERSIONS environment variable.
|
PYENV_VERSION environment variable.
|
||||||
|
|
||||||
$(print_set_version)"
|
$(print_set_version)"
|
||||||
;;
|
;;
|
||||||
shell) echo "usage: pyenv shell <version>
|
shell) echo "usage: pyenv shell <version>
|
||||||
pyenv shell --unset
|
pyenv shell --unset
|
||||||
|
|
||||||
Sets a shell-specific Python version by setting the 'PYENV_VERSIONS'
|
Sets a shell-specific Python version by setting the 'PYENV_VERSION'
|
||||||
environment variable in your shell. This version overrides both
|
environment variable in your shell. This version overrides both
|
||||||
project-specific versions and the global version.
|
project-specific versions and the global version.
|
||||||
|
|
||||||
|
|
|
@ -9,21 +9,21 @@ if [ "$1" = "--complete" ]; then
|
||||||
exec pyenv-versions --bare
|
exec pyenv-versions --bare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYENV_VERSIONS=($@)
|
PYENV_VERSION=($@)
|
||||||
PYENV_VERSION_FILE=".pyenv-version"
|
PYENV_VERSION_FILE=".pyenv-version"
|
||||||
|
|
||||||
if [ "$PYENV_VERSIONS" = "--unset" ]; then
|
if [ "$PYENV_VERSION" = "--unset" ]; then
|
||||||
rm -f "$PYENV_VERSION_FILE"
|
rm -f "$PYENV_VERSION_FILE"
|
||||||
elif [ -n "$PYENV_VERSIONS" ]; then
|
elif [ -n "$PYENV_VERSION" ]; then
|
||||||
pyenv-version-file-write "$PYENV_VERSION_FILE" "${PYENV_VERSIONS[@]}"
|
pyenv-version-file-write "$PYENV_VERSION_FILE" "${PYENV_VERSION[@]}"
|
||||||
else
|
else
|
||||||
IFS=: PYENV_VERSIONS=($(
|
IFS=: PYENV_VERSION=($(
|
||||||
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
|
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
|
||||||
{ echo "pyenv: no local version configured for this directory"
|
{ echo "pyenv: no local version configured for this directory"
|
||||||
exit 1
|
exit 1
|
||||||
} >&2
|
} >&2
|
||||||
))
|
))
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
echo "$PYENV_VERSION"
|
echo "$version"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,24 +9,24 @@ if [ "$1" = "--complete" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
export PYENV_VERSIONS=($@)
|
export PYENV_VERSION=($@)
|
||||||
else
|
else
|
||||||
IFS=: PYENV_VERSIONS=($(pyenv-version-name))
|
IFS=: PYENV_VERSION=($(pyenv-version-name))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PYENV_VERSIONS" = "system" ]; then
|
if [ "$PYENV_VERSION" = "system" ]; then
|
||||||
PYTHON_PATH="$(pyenv-which python)"
|
PYTHON_PATH="$(pyenv-which python)"
|
||||||
echo "${PYTHON_PATH%/*}"
|
echo "${PYTHON_PATH%/*}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYENV_PREFIX_PATHS=()
|
PYENV_PREFIX_PATHS=()
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}"
|
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
|
||||||
if [ -d "$PYENV_PREFIX_PATH" ]; then
|
if [ -d "$PYENV_PREFIX_PATH" ]; then
|
||||||
PYENV_PREFIX_PATHS=("${PYENV_PREFIX_PATHS[@]}" "$PYENV_PREFIX_PATH")
|
PYENV_PREFIX_PATHS=("${PYENV_PREFIX_PATHS[@]}" "$PYENV_PREFIX_PATH")
|
||||||
else
|
else
|
||||||
echo "pyenv: version \`${PYENV_VERSION}' not installed" >&2
|
echo "pyenv: version \`${version}' not installed" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -15,17 +15,17 @@ for version in "$@"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$versions" ]; then
|
if [ -z "$versions" ]; then
|
||||||
if [ -z "$PYENV_VERSIONS" ]; then
|
if [ -z "$PYENV_VERSION" ]; then
|
||||||
echo "pyenv: no shell-specific version configured" >&2
|
echo "pyenv: no shell-specific version configured" >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "echo \"\$PYENV_VERSIONS\""
|
echo "echo \"\${PYENV_VERSION[@]}\""
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$versions" = "--unset" ]; then
|
if [ "$versions" = "--unset" ]; then
|
||||||
echo "unset PYENV_VERSIONS"
|
echo "unset PYENV_VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -34,5 +34,5 @@ pyenv-prefix $versions >/dev/null
|
||||||
|
|
||||||
{
|
{
|
||||||
IFS=:
|
IFS=:
|
||||||
echo "export PYENV_VERSIONS=\"${versions[*]}\""
|
echo "export PYENV_VERSION=(\"${versions[@]}\")"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,23 @@ set -e
|
||||||
|
|
||||||
PYENV_VERSION_FILE="$1"
|
PYENV_VERSION_FILE="$1"
|
||||||
shift
|
shift
|
||||||
PYENV_VERSIONS=()
|
PYENV_VERSION=()
|
||||||
for version in "$@"; do
|
for version in "$@"; do
|
||||||
PYENV_VERSIONS=("${PYENV_VERSIONS[@]}" "$version")
|
PYENV_VERSION=("${PYENV_VERSION[@]}" "$version")
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$PYENV_VERSIONS" ] || [ -z "$PYENV_VERSION_FILE" ]; then
|
if [ -z "$PYENV_VERSION" ] || [ -z "$PYENV_VERSION_FILE" ]; then
|
||||||
echo "usage: pyenv write-version-file FILENAME VERSIONS..." >&2
|
echo "usage: pyenv write-version-file FILENAME VERSIONS..." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure the specified version is installed.
|
# Make sure the specified version is installed.
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
pyenv-prefix "$PYENV_VERSION" >/dev/null
|
pyenv-prefix "$version" >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
# Write the version out to disk.
|
# Write the version out to disk.
|
||||||
rm -f "$PYENV_VERSION_FILE"
|
rm -f "$PYENV_VERSION_FILE"
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
echo "$PYENV_VERSION" >> "$PYENV_VERSION_FILE"
|
echo "$version" >> "$PYENV_VERSION_FILE"
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,23 +2,23 @@
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
if [ -z "$PYENV_VERSIONS" ]; then
|
if [ -z "$PYENV_VERSION" ]; then
|
||||||
PYENV_VERSION_FILE="$(pyenv-version-file)"
|
PYENV_VERSION_FILE="$(pyenv-version-file)"
|
||||||
IFS=: PYENV_VERSIONS=($(pyenv-version-file-read "$PYENV_VERSION_FILE" || true))
|
IFS=: PYENV_VERSION=($(pyenv-version-file-read "$PYENV_VERSION_FILE" || true))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$PYENV_VERSIONS" ] || [ "$PYENV_VERSIONS" = "system" ] ; then
|
if [ -z "$PYENV_VERSION" ] || [ "$PYENV_VERSION" = "system" ] ; then
|
||||||
echo "system"
|
echo "system"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}"
|
PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${version}"
|
||||||
|
|
||||||
if [ ! -d "$PYENV_VERSION_PATH" ]; then
|
if [ ! -d "$PYENV_VERSION_PATH" ]; then
|
||||||
echo "pyenv: version \`$PYENV_VERSION' is not installed" >&2
|
echo "pyenv: version \`$version' is not installed" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS=: echo "${PYENV_VERSIONS[*]}"
|
IFS=: echo "${PYENV_VERSION[*]}"
|
||||||
|
|
|
@ -40,7 +40,7 @@ remove_from_path() {
|
||||||
echo "${result%:}"
|
echo "${result%:}"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=: PYENV_VERSIONS=($(pyenv-version-name))
|
IFS=: PYENV_VERSION=($(pyenv-version-name))
|
||||||
PYENV_COMMAND="$1"
|
PYENV_COMMAND="$1"
|
||||||
|
|
||||||
if [ -z "$PYENV_COMMAND" ]; then
|
if [ -z "$PYENV_COMMAND" ]; then
|
||||||
|
@ -48,12 +48,12 @@ if [ -z "$PYENV_COMMAND" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for PYENV_VERSION in "${PYENV_VERSIONS[@]}"; do
|
for version in "${PYENV_VERSION[@]}"; do
|
||||||
if [ "$PYENV_VERSION" = "system" ]; then
|
if [ "$version" = "system" ]; then
|
||||||
PATH="$(remote_from_path "${PYENV_ROOT}/shims")"
|
PATH="$(remote_from_path "${PYENV_ROOT}/shims")"
|
||||||
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND")"
|
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND")"
|
||||||
else
|
else
|
||||||
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}/bin/${PYENV_COMMAND}"
|
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${version}/bin/${PYENV_COMMAND}"
|
||||||
if [ -x "$PYENV_COMMAND_PATH" ]; then
|
if [ -x "$PYENV_COMMAND_PATH" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue