Fix VIRTUAL_ENV_PROMPT value in activator/activate (#13501)

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
I've compared all the activator scripts here with the original ones in
https://github.com/pypa/virtualenv/tree/main/src/virtualenv/activation
and only the bash/POSIX script here was yielding a VIRTUAL_ENV_PROMPT
value with parenthesis and a trailing space, which should be part of the
shell prompt (PS1 for bash/POSIX) but not of the VIRTUAL_ENV_PROMPT
value itself. This fixes that small inconsistency. Fixes #13456

This reverts commit 0ec2d4e434

## Test Plan

<!-- How was it tested? -->
I didn't test this locally.
This commit is contained in:
Eric Nielsen
2025-05-17 06:48:09 -05:00
committed by GitHub
parent 9d1a14e1f9
commit be1404df2a
+3 -3
View File
@@ -99,9 +99,9 @@ PATH="$VIRTUAL_ENV/{{ BIN_NAME }}:$PATH"
export PATH
if [ "x{{ VIRTUAL_PROMPT }}" != x ] ; then
VIRTUAL_ENV_PROMPT="({{ VIRTUAL_PROMPT }}) "
VIRTUAL_ENV_PROMPT="{{ VIRTUAL_PROMPT }}"
else
VIRTUAL_ENV_PROMPT="($(basename "$VIRTUAL_ENV")) "
VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
fi
export VIRTUAL_ENV_PROMPT
@@ -113,7 +113,7 @@ fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1-}"
PS1="${VIRTUAL_ENV_PROMPT}${PS1-}"
PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
export PS1
fi