mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-12 13:33:52 -05:00
test the existence of ${VIRTUALENV_PIP_BIN} before invoking it
This commit is contained in:
@@ -176,7 +176,7 @@ fi
|
|||||||
|
|
||||||
SEED="$(date "+%Y%m%d%H%M%S").$$"
|
SEED="$(date "+%Y%m%d%H%M%S").$$"
|
||||||
UPGRADE_PATH="${TMP}/pyenv-virtualenv.${SEED}"
|
UPGRADE_PATH="${TMP}/pyenv-virtualenv.${SEED}"
|
||||||
UPGRADE_REQUIREMENTS="${UPGRADE_PATH}/requirements.txt"
|
UPGRADE_LIST="${TMP}/pyenv-virtualenv.${SEED}.txt"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -246,9 +246,13 @@ if [ -d "${VIRTUALENV_PATH}/bin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$UPGRADE" ]; then
|
if [ -n "$UPGRADE" ]; then
|
||||||
mkdir -p "${UPGRADE_PATH}"
|
if [ -x "${VIRTUALENV_PIP_BIN}" ]; then
|
||||||
[ -x "${VIRTUALENV_PIP_BIN}" ] && "${VIRTUALENV_PIP_BIN}" freeze > "${UPGRADE_REQUIREMENTS}"
|
"${VIRTUALENV_PIP_BIN}" freeze > "${UPGRADE_LIST}"
|
||||||
mv -f "${VIRTUALENV_PATH}" "${UPGRADE_PATH}"
|
mv -f "${VIRTUALENV_PATH}" "${UPGRADE_PATH}"
|
||||||
|
else
|
||||||
|
echo "pyenv: pip is not installed in ${VIRTUALENV_PATH}" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -282,10 +286,12 @@ fi
|
|||||||
|
|
||||||
## Migrate previously installed packages from requirements.txt
|
## Migrate previously installed packages from requirements.txt
|
||||||
if [ -n "$UPGRADE" ]; then
|
if [ -n "$UPGRADE" ]; then
|
||||||
[ -x "${VIRTUALENV_PIP_BIN}" ] && [ -f "${UPGRADE_REQUIREMENTS}" ] && {
|
if [ -x "${VIRTUALENV_PIP_BIN}" ]; then
|
||||||
"${VIRTUALENV_PIP_BIN}" install --requirement "${UPGRADE_REQUIREMENTS}"
|
"${VIRTUALENV_PIP_BIN}" install --requirement "${UPGRADE_LIST}" || STATUS=$?
|
||||||
rm -fr "${UPGRADE_PATH}"
|
else
|
||||||
}
|
echo "pyenv: pip is not installed in ${VIRTUALENV_PATH}" 1>&2
|
||||||
|
STATUS=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Execute `after_virtualenv` hooks
|
# Execute `after_virtualenv` hooks
|
||||||
@@ -294,6 +300,10 @@ for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
|||||||
# Run `pyenv-rehash` after a successful installation.
|
# Run `pyenv-rehash` after a successful installation.
|
||||||
if [ "$STATUS" == "0" ]; then
|
if [ "$STATUS" == "0" ]; then
|
||||||
pyenv-rehash
|
pyenv-rehash
|
||||||
|
[ -n "$UPGRADE" ] && {
|
||||||
|
rm -f "${UPGRADE_LIST}"
|
||||||
|
rm -fr "${UPGRADE_PATH}"
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cleanup
|
cleanup
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user