mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-12 21:43:51 -05:00
Skip ensurepip if --no-setuptools, --no-pip or --without-pip is given (fixes #127)
This commit is contained in:
@@ -228,10 +228,11 @@ fi
|
|||||||
VIRTUALENV_OPTIONS=()
|
VIRTUALENV_OPTIONS=()
|
||||||
|
|
||||||
unset FORCE
|
unset FORCE
|
||||||
unset VIRTUALENV_PYTHON
|
unset NO_ENSUREPIP
|
||||||
unset QUIET
|
unset QUIET
|
||||||
unset UPGRADE
|
unset UPGRADE
|
||||||
unset VERBOSE
|
unset VERBOSE
|
||||||
|
unset VIRTUALENV_PYTHON
|
||||||
|
|
||||||
parse_options "$@"
|
parse_options "$@"
|
||||||
for option in "${OPTIONS[@]}"; do
|
for option in "${OPTIONS[@]}"; do
|
||||||
@@ -242,6 +243,14 @@ for option in "${OPTIONS[@]}"; do
|
|||||||
"h" | "help" )
|
"h" | "help" )
|
||||||
usage 0
|
usage 0
|
||||||
;;
|
;;
|
||||||
|
"no-pip" )
|
||||||
|
NO_ENSUREPIP=1
|
||||||
|
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||||
|
;;
|
||||||
|
"no-setuptools" )
|
||||||
|
NO_ENSUREPIP=1
|
||||||
|
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||||
|
;;
|
||||||
"p" | "python" )
|
"p" | "python" )
|
||||||
VIRTUALENV_PYTHON="${ARGUMENTS[0]}"
|
VIRTUALENV_PYTHON="${ARGUMENTS[0]}"
|
||||||
ARGUMENTS=("${ARGUMENTS[@]:1}") # shift 1
|
ARGUMENTS=("${ARGUMENTS[@]:1}") # shift 1
|
||||||
@@ -259,6 +268,10 @@ for option in "${OPTIONS[@]}"; do
|
|||||||
version
|
version
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
"without-pip" )
|
||||||
|
NO_ENSUREPIP=1
|
||||||
|
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||||
|
;;
|
||||||
* ) # virtualenv long options
|
* ) # virtualenv long options
|
||||||
if [[ "$option" == "python="* ]]; then
|
if [[ "$option" == "python="* ]]; then
|
||||||
VIRTUALENV_PYTHON="${option#python=}"
|
VIRTUALENV_PYTHON="${option#python=}"
|
||||||
@@ -462,7 +475,12 @@ if [ -d "${VIRTUALENV_PATH}/bin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$UPGRADE" ]; then
|
if [ -n "$UPGRADE" ]; then
|
||||||
PYENV_VERSION="${VIRTUALENV_NAME}" prepare_requirements
|
if [ -n "${NO_ENSUREPIP}" ]; then
|
||||||
|
echo "pyenv-virtualenv: upgrading will not work with --no-setuptools or --no-pip" 1>&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
PYENV_VERSION="${VIRTUALENV_NAME}" prepare_requirements
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -497,11 +515,13 @@ if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
|||||||
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Install setuptools and pip.
|
if [ -z "${NO_ENSUREPIP}" ]; then
|
||||||
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip
|
## Install setuptools and pip.
|
||||||
|
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip
|
||||||
|
|
||||||
## Migrate previously installed packages from requirements.txt.
|
## Migrate previously installed packages from requirements.txt.
|
||||||
PYENV_VERSION="${VIRTUALENV_NAME}" install_requirements || true
|
PYENV_VERSION="${VIRTUALENV_NAME}" install_requirements || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Execute `after_virtualenv` hooks.
|
# Execute `after_virtualenv` hooks.
|
||||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||||
|
|||||||
Reference in New Issue
Block a user