Skip to content
Closed
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
1 change: 1 addition & 0 deletions Lib/venv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def replace_variables(self, text, context):
text = text.replace('__VENV_DIR__', context.env_dir)
text = text.replace('__VENV_NAME__', context.env_name)
text = text.replace('__VENV_PROMPT__', context.prompt)
text = text.replace('__VENV_DEFAULT_PROMPT__', '(%s) ' % context.env_name)
text = text.replace('__VENV_BIN_NAME__', context.bin_name)
text = text.replace('__VENV_PYTHON__', context.env_exe)
return text
Expand Down
2 changes: 1 addition & 1 deletion Lib/venv/scripts/common/activate
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
if [ "x__VENV_PROMPT__" != x ] ; then
if [[ "y__VENV_PROMPT__" != "y__VENV_DEFAULT_PROMPT__" && "x__VENV_PROMPT__" != x ]] ; then
PS1="__VENV_PROMPT__${PS1:-}"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
Expand Down
2 changes: 1 addition & 1 deletion Lib/venv/scripts/posix/activate.fish
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
set -l old_status $status

# Prompt override?
if test -n "__VENV_PROMPT__"
if test "__VENV_PROMPT__" != "__VENV_DEFAULT_PROMPT__" -a -n "__VENV_PROMPT__"
printf "%s%s" "__VENV_PROMPT__" (set_color normal)
else
# ...Otherwise, prepend env
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Due to the prompt context always being set to a truthy value the string
substitution for the script files was always done to produce a check that
would never fail, impacting the colouring of shells.