Skip to content

Commit 2a378db

Browse files
authored
gh-125398: Convert paths in venv activate script when using Git Bash under Windows (GH-125399)
* Convert paths in venv activate script when using Git Bash under Windows With #112508 the check to converts paths when running on Windows was changed from using the non-posix environment variable `$OSTYPE` to using `uname` instead. However this missed the fact that when running under Git Bash on Windows, uname reports `MINGW*` (`$OSTYPE` is still `msys`). This results in `$PATH` being set to something like `D:\a\github-actions-shells\github-actions-shells\venv/Scripts:…`, instead of `/d/a/github-actions-shells/github-actions-shells/venv/Scripts`. Notably, the Git Bash is the bash shell that’s used for GitHub Actions Windows runners, and ships with VSCode.
1 parent 4b421e8 commit 2a378db

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Lib/venv/scripts/common/activate

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ deactivate nondestructive
3838

3939
# on Windows, a path can contain colons and backslashes and has to be converted:
4040
case "$(uname)" in
41-
CYGWIN*|MSYS*)
42-
# transform D:\path\to\venv to /d/path/to/venv on MSYS
41+
CYGWIN*|MSYS*|MINGW*)
42+
# transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
4343
# and to /cygdrive/d/path/to/venv on Cygwin
4444
VIRTUAL_ENV=$(cygpath "__VENV_DIR__")
4545
export VIRTUAL_ENV
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the conversion of the :envvar:`!VIRTUAL_ENV` path in the activate script in :mod:`venv` when running in Git Bash for Windows.

0 commit comments

Comments
 (0)