mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-103088: Sanitize venv paths when using MSYS or Cygwin Bash (GH-103325)
This commit is contained in:
parent
b57105ae33
commit
ebc8103427
3 changed files with 11 additions and 3 deletions
|
@ -38,8 +38,15 @@ deactivate () {
|
|||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="__VENV_DIR__"
|
||||
export VIRTUAL_ENV
|
||||
# on Windows, a path can contain colons and backslashes and has to be converted:
|
||||
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] ; then
|
||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
||||
export VIRTUAL_ENV=$(cygpath "__VENV_DIR__")
|
||||
else
|
||||
# use the path as-is
|
||||
export VIRTUAL_ENV="__VENV_DIR__"
|
||||
fi
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue