mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-17 16:03:42 -05:00
Replaced pyvenv by -m venv
This commit is contained in:
@@ -160,7 +160,7 @@ EOS
|
||||
IFS="$OLDIFS"
|
||||
fi
|
||||
|
||||
# virtualenv/pyvenv
|
||||
# virtualenv/venv
|
||||
case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
|
||||
@@ -93,7 +93,7 @@ EOS
|
||||
esac
|
||||
fi
|
||||
|
||||
# virtualenv/pyvenv
|
||||
# virtualenv/venv
|
||||
case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
|
||||
@@ -107,7 +107,7 @@ version() {
|
||||
version="$(pyenv-exec conda --version 2>/dev/null || true)"
|
||||
echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (conda ${version:-unknown})"
|
||||
else
|
||||
if [ -n "$USE_PYVENV" ]; then
|
||||
if [ -n "$USE_M_VENV" ]; then
|
||||
echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (python -m venv)"
|
||||
else
|
||||
version="$(pyenv-exec virtualenv --version 2>/dev/null || true)"
|
||||
@@ -122,7 +122,7 @@ usage() {
|
||||
if [ -n "${USE_CONDA}" ]; then
|
||||
pyenv-exec conda create --help 2>/dev/null || true
|
||||
else
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
pyenv-exec python -m venv --help 2>/dev/null || true
|
||||
else
|
||||
pyenv-exec virtualenv --help 2>/dev/null || true
|
||||
@@ -142,15 +142,15 @@ detect_venv() {
|
||||
HAS_VIRTUALENV=1
|
||||
fi
|
||||
if pyenv-exec python -m venv --help 1>/dev/null 2>&1; then
|
||||
HAS_PYVENV=1
|
||||
HAS_M_VENV=1
|
||||
fi
|
||||
fi
|
||||
# Use `python -m venv` only if there is venv available, virtualenv is not installed, and `-p` not given
|
||||
if [ -n "${HAS_CONDA}" ]; then
|
||||
USE_CONDA=1
|
||||
else
|
||||
if [ -n "${HAS_PYVENV}" ] && [ -z "${HAS_VIRTUALENV}" ] && [ -z "${VIRTUALENV_PYTHON}" ]; then
|
||||
USE_PYVENV=1
|
||||
if [ -n "${HAS_M_VENV}" ] && [ -z "${HAS_VIRTUALENV}" ] && [ -z "${VIRTUALENV_PYTHON}" ]; then
|
||||
USE_M_VENV=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -356,9 +356,9 @@ if [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
fi
|
||||
|
||||
unset HAS_VIRTUALENV
|
||||
unset HAS_PYVENV
|
||||
unset HAS_M_VENV
|
||||
unset USE_CONDA
|
||||
unset USE_PYVENV
|
||||
unset USE_M_VENV
|
||||
detect_venv
|
||||
|
||||
SEED="$(date "+%Y%m%d%H%M%S").$$"
|
||||
@@ -369,7 +369,7 @@ REQUIREMENTS="${TMP}/requirements.${SEED}.txt"
|
||||
if [ -n "$UPGRADE" ]; then
|
||||
FORCE=1
|
||||
# `python -m venv` has `--upgrade` by default
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
unset UPGRADE
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--upgrade"
|
||||
fi
|
||||
@@ -402,7 +402,7 @@ if [ -n "${USE_CONDA}" ]; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
# Unset some arguments not supported by `python -m venv`
|
||||
unset QUIET
|
||||
unset VERBOSE
|
||||
@@ -521,7 +521,7 @@ cd "${PYENV_VIRTUALENV_CACHE_PATH}"
|
||||
if [ -n "${USE_CONDA}" ]; then
|
||||
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?"
|
||||
else
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
pyenv-exec python -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
|
||||
else
|
||||
pyenv-exec virtualenv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
|
||||
|
||||
@@ -33,7 +33,7 @@ for version in "${versions[@]}"; do
|
||||
VIRTUALENV_PREFIX_PATH="${PYENV_PREFIX_PATH}"
|
||||
else
|
||||
if [ -f "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" ]; then
|
||||
# pyvenv
|
||||
# venv
|
||||
virtualenv_binpath="$(cut -b 1-1024 "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" | sed -n '/^ *home *= */s///p' || true)"
|
||||
VIRTUALENV_PREFIX_PATH="${virtualenv_binpath%/bin}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user