diff options
author | Brett Cannon <54418+brettcannon@users.noreply.github.com> | 2019-08-21 22:58:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-21 22:58:01 (GMT) |
commit | 48ede6b8f685669f53d26ae8456647af42ae3dae (patch) | |
tree | 212023792f3f4d74cba61067c5539f0a846ec454 /Lib/venv/scripts/common | |
parent | df2d4a6f3d5da2839c4fc11d31511c8e028daf2c (diff) | |
download | cpython-48ede6b8f685669f53d26ae8456647af42ae3dae.zip cpython-48ede6b8f685669f53d26ae8456647af42ae3dae.tar.gz cpython-48ede6b8f685669f53d26ae8456647af42ae3dae.tar.bz2 |
bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization (GH-14941)
The activation scripts generated by venv were inconsistent in how they changed the shell's prompt. Some used `__VENV_PROMPT__` exclusively, some used `__VENV_PROMPT__` if it was set even though by default `__VENV_PROMPT__` is always set and the fallback matched the default, and one ignored `__VENV_PROMPT__` and used `__VENV_NAME__` instead (and even used a differing format to the default prompt). This change now has all activation scripts use `__VENV_PROMPT__` only and relies on the fact that venv sets that value by default.
The color of the customization is also now set in fish to the blue from the Python logo for as hex color support is built into that shell (much like PowerShell where the built-in green color is used).
Diffstat (limited to 'Lib/venv/scripts/common')
-rw-r--r-- | Lib/venv/scripts/common/activate | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Lib/venv/scripts/common/activate b/Lib/venv/scripts/common/activate index fff0765..6a2320a 100644 --- a/Lib/venv/scripts/common/activate +++ b/Lib/venv/scripts/common/activate @@ -54,17 +54,7 @@ fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" - if [ "x__VENV_PROMPT__" != x ] ; then - PS1="__VENV_PROMPT__${PS1:-}" - else - if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then - # special case for Aspen magic directories - # see http://www.zetadev.com/software/aspen/ - PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" - else - PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" - fi - fi + PS1="__VENV_PROMPT__${PS1:-}" export PS1 fi |