mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Compare commits
6 Commits
bc80c02184
...
75d422dcec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75d422dcec | ||
|
|
e8c8fd9b84 | ||
|
|
db299cada3 | ||
|
|
c6bb0694bf | ||
|
|
ebef09bf3d | ||
|
|
a54be0cab2 |
@@ -22,10 +22,8 @@ fi
|
|||||||
|
|
||||||
{ printf "\x1B[31;1m"
|
{ printf "\x1B[31;1m"
|
||||||
echo
|
echo
|
||||||
echo "Failed to activate virtualenv."
|
echo "\`pyenv activate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell."
|
||||||
echo
|
echo "Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions."
|
||||||
echo "Perhaps pyenv-virtualenv has not been loaded into your shell properly."
|
|
||||||
echo "Please restart current shell and try again."
|
|
||||||
echo
|
echo
|
||||||
printf "\x1B[0m"
|
printf "\x1B[0m"
|
||||||
} 1>&2
|
} 1>&2
|
||||||
|
|||||||
@@ -11,10 +11,8 @@ set -e
|
|||||||
|
|
||||||
{ printf "\x1B[31;1m"
|
{ printf "\x1B[31;1m"
|
||||||
echo
|
echo
|
||||||
echo "Failed to deactivate virtualenv."
|
echo "\`pyenv deactivate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell."
|
||||||
echo
|
echo "Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions."
|
||||||
echo "Perhaps pyenv-virtualenv has not been loaded into your shell properly."
|
|
||||||
echo "Please restart current shell and try again."
|
|
||||||
echo
|
echo
|
||||||
printf "\x1B[0m"
|
printf "\x1B[0m"
|
||||||
} 1>&2
|
} 1>&2
|
||||||
|
|||||||
@@ -214,9 +214,11 @@ if [ -d "${prefix}/conda-meta" ] ||
|
|||||||
case "${shell}" in
|
case "${shell}" in
|
||||||
fish )
|
fish )
|
||||||
echo "set -gx CONDA_DEFAULT_ENV \"${CONDA_DEFAULT_ENV}\";"
|
echo "set -gx CONDA_DEFAULT_ENV \"${CONDA_DEFAULT_ENV}\";"
|
||||||
|
echo "set -gx CONDA_PREFIX \"${prefix}\";"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
echo "export CONDA_DEFAULT_ENV=\"${CONDA_DEFAULT_ENV}\";"
|
echo "export CONDA_DEFAULT_ENV=\"${CONDA_DEFAULT_ENV}\";"
|
||||||
|
echo "export CONDA_PREFIX=\"${prefix}\";"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ if [ -d "${prefix}/conda-meta" ] ||
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
case "${shell}" in
|
case "${shell}" in
|
||||||
fish )
|
fish )
|
||||||
: # conda doesn't support fish
|
echo "set -e CONDA_PREFIX"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do
|
for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do
|
||||||
|
|||||||
@@ -605,7 +605,13 @@ STATUS=0
|
|||||||
mkdir -p "${PYENV_VIRTUALENV_CACHE_PATH}"
|
mkdir -p "${PYENV_VIRTUALENV_CACHE_PATH}"
|
||||||
cd "${PYENV_VIRTUALENV_CACHE_PATH}"
|
cd "${PYENV_VIRTUALENV_CACHE_PATH}"
|
||||||
if [ -n "${USE_CONDA}" ]; then
|
if [ -n "${USE_CONDA}" ]; then
|
||||||
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?"
|
if [ -z "$VIRTUALENV_PYTHON" ]; then
|
||||||
|
#process substitution doesn't seem to work unless it's directly inserted to the command line
|
||||||
|
#if we add it to VIRTUALENV_OPTIONS instead, "broken pipe" happens
|
||||||
|
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" --file <(pyenv-exec conda list python --full-name --export) || STATUS="$?"
|
||||||
|
else
|
||||||
|
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" || STATUS="$?"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [ -n "${USE_M_VENV}" ]; then
|
if [ -n "${USE_M_VENV}" ]; then
|
||||||
pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
|
pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
|
||||||
@@ -625,7 +631,8 @@ fi
|
|||||||
|
|
||||||
## Create symlink in the `versions` directory for backward compatibility
|
## Create symlink in the `versions` directory for backward compatibility
|
||||||
if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||||
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
# Overwrite an existing link, can happen if running with -f
|
||||||
|
ln -fsn "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then
|
if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ unstub_pyenv() {
|
|||||||
run pyenv-virtualenv venv
|
run pyenv-virtualenv venv
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output_wildcards <<OUT
|
||||||
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python
|
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes --file /dev/fd/*
|
||||||
rehashed
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ OUT
|
|||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5 python
|
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5
|
||||||
rehashed
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ OUT
|
|||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5 python
|
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5
|
||||||
rehashed
|
rehashed
|
||||||
OUT
|
OUT
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
load test_helper
|
load test_helper
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ assert_equal() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_equal_wildcards() {
|
||||||
|
if [[ $1 != $2 ]]; then
|
||||||
|
{ echo "expected:"
|
||||||
|
echo "$2"
|
||||||
|
echo "actual:"
|
||||||
|
echo "$1"
|
||||||
|
} | flunk
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
assert_output() {
|
assert_output() {
|
||||||
local expected
|
local expected
|
||||||
if [ $# -eq 0 ]; then expected="$(cat -)"
|
if [ $# -eq 0 ]; then expected="$(cat -)"
|
||||||
@@ -91,6 +101,14 @@ assert_output() {
|
|||||||
assert_equal "$expected" "$output"
|
assert_equal "$expected" "$output"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_output_wildcards() {
|
||||||
|
local expected
|
||||||
|
if [ $# -eq 0 ]; then expected="$(cat -)"
|
||||||
|
else expected="$1"
|
||||||
|
fi
|
||||||
|
assert_equal_wildcards "$output" "$expected"
|
||||||
|
}
|
||||||
|
|
||||||
assert_output_contains() {
|
assert_output_contains() {
|
||||||
local expected="$1"
|
local expected="$1"
|
||||||
echo "$output" | grep -F "$expected" >/dev/null || {
|
echo "$output" | grep -F "$expected" >/dev/null || {
|
||||||
|
|||||||
Reference in New Issue
Block a user