Skip to content

Suppress activate/deactivate messages by default #169

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

Merged
merged 7 commits into from
Apr 19, 2016
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion bin/pyenv-sh-activate
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ fi

pyenv-sh-deactivate --force --quiet ${VERBOSE+--verbose} || true

echo "pyenv-virtualenv: activate ${venv}" 1>&2
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you think how we should manage existing ${VERBOSE} here? In my guts feeling, this line should care about both ${VERBOSE} and ${PYENV_VIRTUALENV_VERBOSE_ACTIVATE} too....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" -a -n "$VERBOSE" ] ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERBOSE seems to be used with the called tools only currently?! (python/pip)

I assume the main this about this PR is to change this after all?!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically the ${VERBOSE} is used mainly from internally. I think just checking ${PYENV_VIRTUALENV_VERBOSE_ACTIVATE} here could be sufficient at least for now.

echo "pyenv-virtualenv: activate ${venv}" 1>&2
fi

if [ -z "$no_shell" ]; then
# shell version set in pyenv-sh-activate should be unset
Expand Down
4 changes: 3 additions & 1 deletion bin/pyenv-sh-deactivate
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ else
venv="${prefix##*/}"
fi

echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
fi

if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then
# shell version set in pyenv-sh-activate should be unset
Expand Down
11 changes: 2 additions & 9 deletions test/activate.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ setup() {
unset CONDA_DEFAULT_ENV
unset PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
unset PYENV_VIRTUALENV_DISABLE_PROMPT
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
unset VIRTUAL_ENV_DISABLE_PROMPT
Expand All @@ -30,7 +31,6 @@ setup() {
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
Expand All @@ -46,6 +46,7 @@ EOS

@test "activate virtualenv from current version (verbose)" {
export PYENV_VIRTUALENV_INIT=1
export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1

stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
Expand Down Expand Up @@ -84,7 +85,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv
export PYENV_VERSION="venv";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
Expand Down Expand Up @@ -113,7 +113,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
pyenv-virtualenv: prompt changing not working for fish.
Expand All @@ -138,7 +137,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv
setenv PYENV_VERSION "venv";
setenv PYENV_ACTIVATE_SHELL 1;
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
Expand All @@ -164,7 +162,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
Expand All @@ -191,7 +188,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
Expand All @@ -218,7 +214,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv27
setenv PYENV_VERSION "venv27";
setenv PYENV_ACTIVATE_SHELL 1;
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
Expand All @@ -243,7 +238,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv27
setenv PYENV_VERSION "venv27";
setenv PYENV_ACTIVATE_SHELL 1;
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
Expand Down Expand Up @@ -367,7 +361,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27:2.7.10";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
Expand Down
6 changes: 1 addition & 5 deletions test/conda-activate.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ setup() {
unset CONDA_DEFAULT_ENV
unset PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
unset PYENV_VIRTUALENV_DISABLE_PROMPT
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
unset VIRTUAL_ENV_DISABLE_PROMPT
Expand All @@ -32,7 +33,6 @@ setup() {
assert_success
assert_output <<EOS
deactivated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE in the setup of this file.

pyenv-virtualenv: activate anaconda-2.3.0
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
export CONDA_DEFAULT_ENV="root";
Expand Down Expand Up @@ -62,7 +62,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate anaconda-2.3.0
setenv PYENV_VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
setenv VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
setenv CONDA_DEFAULT_ENV "root";
Expand Down Expand Up @@ -90,7 +89,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate miniconda-3.9.1
export PYENV_VERSION="miniconda-3.9.1";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
Expand Down Expand Up @@ -122,7 +120,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate anaconda-2.3.0/envs/foo
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
export CONDA_DEFAULT_ENV="foo";
Expand Down Expand Up @@ -152,7 +149,6 @@ EOS
assert_success
assert_output <<EOS
deactivated
pyenv-virtualenv: activate miniconda-3.9.1/envs/bar
export PYENV_VERSION="miniconda-3.9.1/envs/bar";
export PYENV_ACTIVATE_SHELL=1;
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
Expand Down
4 changes: 1 addition & 3 deletions test/conda-deactivate.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ setup() {
unset CONDA_DEFAULT_ENV
unset PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
unset PYENV_VIRTUALENV_DISABLE_PROMPT
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
unset VIRTUAL_ENV_DISABLE_PROMPT
Expand All @@ -29,7 +30,6 @@ setup() {

assert_success
assert_output <<EOS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE in the setup of this file.

pyenv-virtualenv: deactivate anaconda-2.3.0
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
unset CONDA_DEFAULT_ENV;
Expand Down Expand Up @@ -65,7 +65,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate anaconda-2.3.0
set -e PYENV_VIRTUAL_ENV;
set -e VIRTUAL_ENV;
set -e CONDA_DEFAULT_ENV;
Expand Down Expand Up @@ -97,7 +96,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate anaconda-2.3.0/envs/foo
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
unset CONDA_DEFAULT_ENV;
Expand Down
12 changes: 2 additions & 10 deletions test/deactivate.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ setup() {
unset CONDA_DEFAULT_ENV
unset PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
unset PYENV_VIRTUALENV_DISABLE_PROMPT
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
unset VIRTUAL_ENV_DISABLE_PROMPT
Expand All @@ -27,7 +28,6 @@ setup() {

assert_success
assert_output <<EOS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE in the setup of this file.

pyenv-virtualenv: deactivate venv
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
Expand All @@ -53,6 +53,7 @@ EOS
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
export PYENV_ACTIVATE_SHELL=
export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding test case for PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1 is nice 👍


PYENV_SHELL="bash" run pyenv-sh-deactivate --verbose

Expand Down Expand Up @@ -89,7 +90,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
Expand Down Expand Up @@ -120,7 +120,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
unset PYENV_VERSION;
unset PYENV_ACTIVATE_SHELL;
unset PYENV_VIRTUAL_ENV;
Expand Down Expand Up @@ -153,7 +152,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
unset PYENV_VERSION;
unset PYENV_ACTIVATE_SHELL;
unset PYENV_VIRTUAL_ENV;
Expand Down Expand Up @@ -186,7 +184,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
Expand Down Expand Up @@ -217,7 +214,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
set -e PYENV_VIRTUAL_ENV;
set -e VIRTUAL_ENV;
if [ -n "\$_OLD_VIRTUAL_PATH" ];
Expand All @@ -244,7 +240,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
set -e PYENV_VIRTUAL_ENV;
set -e VIRTUAL_ENV;
if [ -n "\$_OLD_VIRTUAL_PATH" ];
Expand All @@ -271,7 +266,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
set -e PYENV_VERSION;
set -e PYENV_ACTIVATE_SHELL;
set -e PYENV_VIRTUAL_ENV;
Expand Down Expand Up @@ -300,7 +294,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
set -e PYENV_VERSION;
set -e PYENV_ACTIVATE_SHELL;
set -e PYENV_VIRTUAL_ENV;
Expand Down Expand Up @@ -329,7 +322,6 @@ EOS

assert_success
assert_output <<EOS
pyenv-virtualenv: deactivate venv
set -e PYENV_VIRTUAL_ENV;
set -e VIRTUAL_ENV;
if [ -n "\$_OLD_VIRTUAL_PATH" ];
Expand Down