Skip to content

bpo-35328: Set VIRTUAL_ENV_PROMPT at venv activation #10745

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

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion Lib/venv/scripts/common/activate
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ deactivate () {
fi

unset VIRTUAL_ENV
unset VIRTUAL_ENV_PROMPT
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
Expand Down Expand Up @@ -55,8 +56,10 @@ fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
if [ "x__VENV_PROMPT__" != x ] ; then
PS1="__VENV_PROMPT__${PS1:-}"
VIRTUAL_ENV_PROMPT="__VENV_PROMPT__"
PS1="__VENV_PROMPT__${PS1:-}"
else
VIRTUAL_ENV_PROMPT="`basename \"$VIRTUAL_ENV\"`"
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
Expand All @@ -65,6 +68,7 @@ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export VIRTUAL_ENV_PROMPT
export PS1
fi

Expand Down