mirror of https://github.com/python/cpython
gh-112507: Detect Cygwin and MSYS with `uname` instead of `$OSTYPE` (GH-112508)
Detect Cygwin and MSYS with `uname` instead of `$OSTYPE` `$OSTYPE` is not defined by POSIX and may not be present in other shells. `uname` is always available in any shell.
This commit is contained in:
parent
f4fe65e2dd
commit
d7b5f10231
|
@ -36,14 +36,18 @@ deactivate () {
|
||||||
deactivate nondestructive
|
deactivate nondestructive
|
||||||
|
|
||||||
# on Windows, a path can contain colons and backslashes and has to be converted:
|
# on Windows, a path can contain colons and backslashes and has to be converted:
|
||||||
if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then
|
case "$(uname)" in
|
||||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
CYGWIN*|MSYS*)
|
||||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
||||||
export VIRTUAL_ENV=$(cygpath "__VENV_DIR__")
|
# and to /cygdrive/d/path/to/venv on Cygwin
|
||||||
else
|
VIRTUAL_ENV=$(cygpath "__VENV_DIR__")
|
||||||
# use the path as-is
|
export VIRTUAL_ENV
|
||||||
export VIRTUAL_ENV="__VENV_DIR__"
|
;;
|
||||||
fi
|
*)
|
||||||
|
# use the path as-is
|
||||||
|
export VIRTUAL_ENV="__VENV_DIR__"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
_OLD_VIRTUAL_PATH="$PATH"
|
_OLD_VIRTUAL_PATH="$PATH"
|
||||||
PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH"
|
PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH"
|
||||||
|
|
Loading…
Reference in New Issue