Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect & create conda environments #327

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions bin/pyenv-virtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,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
Expand Down Expand Up @@ -576,7 +579,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="$?"
Expand Down