mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-09 20:13:47 -05:00
* Cleanup mocks logic * Add test for `:latest`
This commit is contained in:
@@ -120,8 +120,8 @@ unset VERSION_NAME
|
||||
# version is specified by pyenv. Show usage instructions if a local
|
||||
# version is not specified.
|
||||
DEFINITIONS=("${ARGUMENTS[@]}")
|
||||
[ -n "${DEFINITIONS[*]}" ] || DEFINITIONS=($(pyenv-local 2>/dev/null || true))
|
||||
[ -n "${DEFINITIONS[*]}" ] || usage 1 >&2
|
||||
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && DEFINITIONS=($(pyenv-local 2>/dev/null || true))
|
||||
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && usage 1 >&2
|
||||
|
||||
# Define `before_install` and `after_install` functions that allow
|
||||
# plugin hooks to register a string of code for execution before or
|
||||
@@ -151,7 +151,10 @@ IFS=$'\n' scripts=(`pyenv-hooks install`)
|
||||
IFS="$OLDIFS"
|
||||
for script in "${scripts[@]}"; do source "$script"; done
|
||||
|
||||
for DEFINITION in "${DEFINITIONS[@]}";do
|
||||
COMBINED_STATUS=0
|
||||
for DEFINITION in "${DEFINITIONS[@]}"; do
|
||||
STATUS=0
|
||||
|
||||
# Try to resolve a prefix if user indeed gave a prefix.
|
||||
# We install the version under the resolved name
|
||||
# and hooks also see the resolved name
|
||||
@@ -173,7 +176,7 @@ for DEFINITION in "${DEFINITIONS[@]}";do
|
||||
|
||||
case "$REPLY" in
|
||||
y | Y | yes | YES ) ;;
|
||||
* ) exit 1 ;;
|
||||
* ) { STATUS=1; [[ $STATUS -gt $COMBINED_STATUS ]] && COMBINED_STATUS=$STATUS; }; continue ;;
|
||||
esac
|
||||
elif [ -n "$SKIP_EXISTING" ]; then
|
||||
# Since we know the python version is already installed, and are opting to
|
||||
@@ -247,8 +250,8 @@ for DEFINITION in "${DEFINITIONS[@]}";do
|
||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
# Invoke `python-build` and record the exit status in $STATUS.
|
||||
STATUS=0
|
||||
python-build $KEEP $VERBOSE $HAS_PATCH $DEBUG "$DEFINITION" "$PREFIX" || STATUS="$?"
|
||||
python-build $KEEP $VERBOSE $HAS_PATCH $DEBUG "$DEFINITION" "$PREFIX" || \
|
||||
{ STATUS=$?; [[ $STATUS -gt $COMBINED_STATUS ]] && COMBINED_STATUS=$STATUS; }
|
||||
|
||||
# Display a more helpful message if the definition wasn't found.
|
||||
if [ "$STATUS" == "2" ]; then
|
||||
@@ -279,13 +282,14 @@ for DEFINITION in "${DEFINITIONS[@]}";do
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
# Run `pyenv-rehash` after a successful installation.
|
||||
if [ "$STATUS" == "0" ]; then
|
||||
if [[ $STATUS -eq 0 ]]; then
|
||||
pyenv-rehash
|
||||
else
|
||||
break
|
||||
cleanup
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
exit "${STATUS:-0}"
|
||||
|
||||
exit "${COMBINED_STATUS}"
|
||||
|
||||
Reference in New Issue
Block a user