mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-13 05:53:52 -05:00
Merge pull request #174 from yyuu/conda-activate-d
Source conda package activate/deactivat scripts if exist
This commit is contained in:
@@ -231,3 +231,19 @@ EOS
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# conda package anaconda/miniconda scripts (#173)
|
||||||
|
if [ -x "${prefix}/bin/conda" ]; then
|
||||||
|
shopt -s nullglob
|
||||||
|
case "${shell}" in
|
||||||
|
fish )
|
||||||
|
: # conda doesn't support fish
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
for script in "${prefix}/etc/conda/activate.d"/*.sh; do
|
||||||
|
echo ". \"${script}\";"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shopt -u nullglob
|
||||||
|
fi
|
||||||
|
|||||||
@@ -58,6 +58,22 @@ if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
|
|||||||
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
|
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# conda package anaconda/miniconda scripts (#173)
|
||||||
|
if [ -x "${prefix}/bin/conda" ]; then
|
||||||
|
shopt -s nullglob
|
||||||
|
case "${shell}" in
|
||||||
|
fish )
|
||||||
|
: # conda doesn't support fish
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do
|
||||||
|
echo ". \"${script}\";"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shopt -u nullglob
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then
|
if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then
|
||||||
# shell version set in pyenv-sh-activate should be unset
|
# shell version set in pyenv-sh-activate should be unset
|
||||||
# https://github.com/yyuu/pyenv-virtualenv/issues/61
|
# https://github.com/yyuu/pyenv-virtualenv/issues/61
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ export CONDA_DEFAULT_ENV="foo";
|
|||||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||||
export PS1="(anaconda-2.3.0/envs/foo) \${PS1}";
|
export PS1="(anaconda-2.3.0/envs/foo) \${PS1}";
|
||||||
|
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/activate.d/activate.sh";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-version-name
|
unstub pyenv-version-name
|
||||||
@@ -157,6 +158,7 @@ export CONDA_DEFAULT_ENV="bar";
|
|||||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||||
export PS1="(miniconda-3.9.1/envs/bar) \${PS1}";
|
export PS1="(miniconda-3.9.1/envs/bar) \${PS1}";
|
||||||
|
. "${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar/etc/conda/activate.d/activate.sh";
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
unstub pyenv-virtualenv-prefix
|
unstub pyenv-virtualenv-prefix
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ EOS
|
|||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
|
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/deactivate.d/deactivate.sh";
|
||||||
unset PYENV_VIRTUAL_ENV;
|
unset PYENV_VIRTUAL_ENV;
|
||||||
unset VIRTUAL_ENV;
|
unset VIRTUAL_ENV;
|
||||||
unset CONDA_DEFAULT_ENV;
|
unset CONDA_DEFAULT_ENV;
|
||||||
|
|||||||
@@ -163,8 +163,11 @@ setup_conda() {
|
|||||||
create_executable "${conda}/envs/${env}" "activate"
|
create_executable "${conda}/envs/${env}" "activate"
|
||||||
remove_executable "${conda}/envs/${env}" "pyvenv"
|
remove_executable "${conda}/envs/${env}" "pyvenv"
|
||||||
create_executable "${conda}/envs/${env}" "conda"
|
create_executable "${conda}/envs/${env}" "conda"
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d"
|
||||||
|
touch "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d/activate.sh"
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d"
|
||||||
|
touch "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d/deactivate.sh"
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown_conda() {
|
teardown_conda() {
|
||||||
|
|||||||
Reference in New Issue
Block a user