Fix broken pyenv local

This commit is contained in:
Yamashita, Yuu 2016-03-04 00:00:53 +00:00
parent 41ce3aade2
commit be3fc6d8cb

View file

@ -32,27 +32,17 @@ fi
versions=("$@") versions=("$@")
if [ "$versions" = "--unset" ]; then if [ "$versions" = "--unset" ]; then
rm -f .python-version .pyenv-version rm -f .python-version
elif [ -n "$versions" ]; then elif [ -n "$versions" ]; then
previous_file="$(PYENV_VERSION= pyenv-version-origin || true)"
pyenv-version-file-write .python-version "${versions[@]}" pyenv-version-file-write .python-version "${versions[@]}"
if [ "$previous_file" -ef .pyenv-version ]; then
rm -f .pyenv-version
{ echo "pyenv: removed existing \`.pyenv-version' file and migrated"
echo " local version specification to \`.python-version' file"
} >&2
fi
else else
OLDIFS="$IFS" if version_file="$(pyenv-version-file "$PWD")"; then
IFS=: versions=($( IFS=: versions=($(pyenv-version-file-read "$version_file"))
pyenv-version-file-read .python-version || for version in "${versions[@]}"; do
pyenv-version-file-read .pyenv-version || echo "$version"
{ echo "pyenv: no local version configured for this directory" done
exit 1 else
} >&2 echo "pyenv: no local version configured for this directory" >&2
)) exit 1
IFS="$OLDIFS" fi
for version in "${versions[@]}"; do
echo "$version"
done
fi fi