From 4de2bf01b68d662944ea0cd9e0745789723c8d5d Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sun, 24 Nov 2024 22:52:06 +0300 Subject: [PATCH 1/2] Fix pyenv-virtualenv using a different Python version in a conda environment --- bin/pyenv-virtualenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index f3b0f1b2..7e5ebd78 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -605,7 +605,7 @@ 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="$?" + pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" --file <(pyenv-exec conda list python --full-name --export) || STATUS="$?" else if [ -n "${USE_M_VENV}" ]; then pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" From f4e7425815851183bc31a0332ae6ba7aae9c21fd Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Mon, 25 Nov 2024 00:49:01 +0300 Subject: [PATCH 2/2] Fix tests; allow output checking with wildcards --- bin/pyenv-virtualenv | 8 +++++++- test/conda.bats | 8 ++++---- test/deactivate.bats | 2 +- test/test_helper.bash | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index 7e5ebd78..a2a772ce 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -605,7 +605,13 @@ 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[@]}" --file <(pyenv-exec conda list python --full-name --export) || 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 if [ -n "${USE_M_VENV}" ]; then pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" diff --git a/test/conda.bats b/test/conda.bats index 43a7bf68..6e186868 100644 --- a/test/conda.bats +++ b/test/conda.bats @@ -32,8 +32,8 @@ unstub_pyenv() { run pyenv-virtualenv venv assert_success - assert_output </dev/null || {