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=()
|
||||
|
||||
unset FORCE
|
||||
unset VIRTUALENV_PYTHON
|
||||
unset NO_ENSUREPIP
|
||||
unset QUIET
|
||||
unset UPGRADE
|
||||
unset VERBOSE
|
||||
unset VIRTUALENV_PYTHON
|
||||
|
||||
parse_options "$@"
|
||||
for option in "${OPTIONS[@]}"; do
|
||||
@@ -242,6 +243,14 @@ for option in "${OPTIONS[@]}"; do
|
||||
"h" | "help" )
|
||||
usage 0
|
||||
;;
|
||||
"no-pip" )
|
||||
NO_ENSUREPIP=1
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||
;;
|
||||
"no-setuptools" )
|
||||
NO_ENSUREPIP=1
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||
;;
|
||||
"p" | "python" )
|
||||
VIRTUALENV_PYTHON="${ARGUMENTS[0]}"
|
||||
ARGUMENTS=("${ARGUMENTS[@]:1}") # shift 1
|
||||
@@ -259,6 +268,10 @@ for option in "${OPTIONS[@]}"; do
|
||||
version
|
||||
exit 0
|
||||
;;
|
||||
"without-pip" )
|
||||
NO_ENSUREPIP=1
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--$option"
|
||||
;;
|
||||
* ) # virtualenv long options
|
||||
if [[ "$option" == "python="* ]]; then
|
||||
VIRTUALENV_PYTHON="${option#python=}"
|
||||
@@ -462,8 +475,13 @@ if [ -d "${VIRTUALENV_PATH}/bin" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$UPGRADE" ]; then
|
||||
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
|
||||
|
||||
# Execute `before_virtualenv` hooks.
|
||||
@@ -497,11 +515,13 @@ if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
||||
fi
|
||||
|
||||
## Install setuptools and pip.
|
||||
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip
|
||||
if [ -z "${NO_ENSUREPIP}" ]; then
|
||||
## Install setuptools and pip.
|
||||
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip
|
||||
|
||||
## Migrate previously installed packages from requirements.txt.
|
||||
PYENV_VERSION="${VIRTUALENV_NAME}" install_requirements || true
|
||||
## Migrate previously installed packages from requirements.txt.
|
||||
PYENV_VERSION="${VIRTUALENV_NAME}" install_requirements || true
|
||||
fi
|
||||
|
||||
# Execute `after_virtualenv` hooks.
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
Reference in New Issue
Block a user