Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.1k
Comments
gh-112507 Detect Cygwin and MSYS withuname instead of$OSTYPE#112508
gh-112507 Detect Cygwin and MSYS withuname instead of$OSTYPE#112508vsajip merged 1 commit intopython:mainfrom
uname instead of$OSTYPE#112508Conversation
`$OSTYPE` is not defined by POSIX and may not be present in other shells.`uname` is always available in any shell.
| # transform D:\path\to\venv to /d/path/to/venv on MSYS | ||
| # and to /cygdrive/d/path/to/venv on Cygwin | ||
| VIRTUAL_ENV=$(cygpath "__VENV_DIR__") | ||
| export VIRTUAL_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just a minor point - whyexport on a separate line instead ofexport VIRTUAL_ENV=$(cygpath "__VENV_DIR__") as it was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Declaring and assigning a variable at the same time can mask the return value if the command fails. Doing them separately won't which can help with debugging and error handling.
Sorry,@J-M0 and@vsajip, I could not cleanly backport this to |
Sorry,@J-M0 and@vsajip, I could not cleanly backport this to |
…YPE` (pythonGH-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.
…YPE` (pythonGH-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.
Withpython#112508 the check to change 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 MinGW shell, 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 shell for Windows behaves like this, and this is also the bash shell that’s used for GitHub Actions Windows runners.
Withpython#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.
Withpython#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.
…under Windows (GH-125399)* Convert paths in venv activate script when using Git Bash under WindowsWith#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.
… Bash under Windows (pythonGH-125399)* Convert paths in venv activate script when using Git Bash under WindowsWithpython#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.(cherry picked from commit2a378db)Co-authored-by: Julien <julien@caffeine.lu>
… Bash under Windows (pythonGH-125399)* Convert paths in venv activate script when using Git Bash under WindowsWithpython#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.
hugovk commentedFeb 26, 2025
…f `$OSTYPE` (pythonGH-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.(cherry picked from commitd7b5f10)Co-authored-by: James Morris <6653392+J-M0@users.noreply.github.com>
GH-130674 is a backport of this pull request to the3.12 branch. |
Uh oh!
There was an error while loading.Please reload this page.
$OSTYPEis not defined by POSIX and may not be present in other shells.unameis always available in any shell.unameinstead of$OSTYPEto detect Cygwin and MSYS #112507