gh-112507 Detect Cygwin and MSYS with uname instead of $OSTYPE#112508
Merged
vsajip merged 1 commit intopython:mainfrom Dec 11, 2023
Merged
gh-112507 Detect Cygwin and MSYS with uname instead of $OSTYPE#112508vsajip merged 1 commit intopython:mainfrom
uname instead of $OSTYPE#112508vsajip merged 1 commit intopython:mainfrom
Conversation
`$OSTYPE` is not defined by POSIX and may not be present in other shells. `uname` is always available in any shell.
vsajip
reviewed
Dec 11, 2023
| # 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 |
Member
There was a problem hiding this comment.
Just a minor point - why export on a separate line instead of export VIRTUAL_ENV=$(cygpath "__VENV_DIR__") as it was before?
Contributor
Author
There was a problem hiding this comment.
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.
vsajip
approved these changes
Dec 11, 2023
|
Sorry, @J-M0 and @vsajip, I could not cleanly backport this to |
|
Sorry, @J-M0 and @vsajip, I could not cleanly backport this to |
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
…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.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
…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.
julienp
added a commit
to julienp/cpython
that referenced
this pull request
Oct 13, 2024
With python#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.
julienp
added a commit
to julienp/cpython
that referenced
this pull request
Oct 13, 2024
With python#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.
This was referenced Oct 13, 2024
julienp
added a commit
to julienp/cpython
that referenced
this pull request
Oct 13, 2024
With python#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.
vsajip
pushed a commit
that referenced
this pull request
Oct 19, 2024
…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.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 19, 2024
… Bash under Windows (pythonGH-125399) * Convert paths in venv activate script when using Git Bash under Windows With python#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 commit 2a378db) Co-authored-by: Julien <julien@caffeine.lu>
ebonnal
pushed a commit
to ebonnal/cpython
that referenced
this pull request
Jan 12, 2025
… Bash under Windows (pythonGH-125399) * Convert paths in venv activate script when using Git Bash under Windows With python#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.
Member
vsajip
pushed a commit
to vsajip/cpython
that referenced
this pull request
Feb 28, 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 commit d7b5f10) Co-authored-by: James Morris <6653392+J-M0@users.noreply.github.com>
|
GH-130674 is a backport of this pull request to the 3.12 branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
$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