mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-23 02:31:59 +00:00
26 lines
614 B
Bash
Executable file
26 lines
614 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
PYENV_VERSION_FILE="$1"
|
|
shift
|
|
PYENV_VERSION=()
|
|
for version in "$@"; do
|
|
PYENV_VERSION=("${PYENV_VERSION[@]}" "$version")
|
|
done
|
|
|
|
if [ -z "$PYENV_VERSION" ] || [ -z "$PYENV_VERSION_FILE" ]; then
|
|
echo "usage: pyenv write-version-file FILENAME VERSIONS..." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure the specified version is installed.
|
|
for version in "${PYENV_VERSION[@]}"; do
|
|
pyenv-prefix "$version" >/dev/null
|
|
done
|
|
|
|
# Write the version out to disk.
|
|
rm -f "$PYENV_VERSION_FILE"
|
|
for version in "${PYENV_VERSION[@]}"; do
|
|
echo "$version" >> "$PYENV_VERSION_FILE"
|
|
done
|