4 Commits

Author SHA1 Message Date
Luis Marsano
85e513dc9f Merge 999a0f2cbc into 28cd9be54e 2024-09-25 20:09:26 -04:00
Ivan Pozdeev
999a0f2cbc Merge branch 'master' into pr 2022-10-14 04:39:06 +03:00
Luis Marsano
a96eac5409 clone non-base conda environments
detect base conda by testing for `envs` directory
create or clone accordingly
2019-10-09 06:09:34 -04:00
Luis Marsano
9c233132eb detect conda environments
non-base conda environments lack bin/conda
apply same solution as #290
2019-10-09 06:08:17 -04:00

View File

@@ -149,8 +149,11 @@ detect_venv() {
# Check the existence of executables as a workaround for the issue with pyenv-which-ext
# https://github.com/yyuu/pyenv-virtualenv/issues/26
local prefix="$(pyenv-prefix)"
if [ -x "${prefix}/bin/conda" ]; then
if [ -d "${prefix}/conda-meta" ] || [ -x "${prefix}/bin/conda" ]; then
HAS_CONDA=1
if [ -d "${prefix}/envs" ]; then
IS_BASE_CONDA=1
fi
else
if [ -x "${prefix}/bin/virtualenv" ]; then
HAS_VIRTUALENV=1
@@ -605,7 +608,11 @@ STATUS=0
mkdir -p "${PYENV_VIRTUALENV_CACHE_PATH}"
cd "${PYENV_VIRTUALENV_CACHE_PATH}"
if [ -n "${USE_CONDA}" ]; then
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?"
if [ -n "${IS_BASE_CONDA}" ]; then
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?"
else
pyenv-exec conda create $QUIET $VERBOSE --clone "${VERSION_NAME##*/}" --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" || STATUS="$?"
fi
else
if [ -n "${USE_M_VENV}" ]; then
pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"