Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

gh-112507 Detect Cygwin and MSYS withuname instead of$OSTYPE#112508

Merged
vsajip merged 1 commit intopython:mainfrom
J-M0:venv_ostype
Dec 11, 2023
Merged

gh-112507 Detect Cygwin and MSYS withuname instead of$OSTYPE#112508
vsajip merged 1 commit intopython:mainfrom
J-M0:venv_ostype

Conversation

@J-M0
Copy link
Contributor

@J-M0J-M0 commentedNov 29, 2023
edited by bedevere-appbot
Loading

$OSTYPE is not defined by POSIX and may not be present in other shells.uname is always available in any shell.

`$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
Copy link
Member

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?

Copy link
ContributorAuthor

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.

https://www.shellcheck.net/wiki/SC2155

vsajip reacted with thumbs up emoji
@vsajipvsajip merged commitd7b5f10 intopython:mainDec 11, 2023
@vsajipvsajip added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsDec 11, 2023
@miss-islington-app
Copy link

Thanks@J-M0 for the PR, and@vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks@J-M0 for the PR, and@vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@J-M0 and@vsajip, I could not cleanly backport this to3.11 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker d7b5f102319bb0389c5248e9ecf533eae4163424 3.11

@miss-islington-app
Copy link

Sorry,@J-M0 and@vsajip, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker d7b5f102319bb0389c5248e9ecf533eae4163424 3.12

@J-M0J-M0 deleted the venv_ostype branchJanuary 3, 2024 18:21
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 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 requestSep 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 requestOct 13, 2024
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.
julienp added a commit to julienp/cpython that referenced this pull requestOct 13, 2024
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.
julienp added a commit to julienp/cpython that referenced this pull requestOct 13, 2024
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.
vsajip pushed a commit that referenced this pull requestOct 19, 2024
…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.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 19, 2024
… 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>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull requestJan 12, 2025
… 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.
@ZeroIntensityZeroIntensity removed the needs backport to 3.11only security fixes labelFeb 17, 2025
@hugovk
Copy link
Member

@J-M0@vsajip Triage: is the 3.12 backport still needed? If so, please could you create it? Otherwise, let's remove the backport label.

vsajip pushed a commit to vsajip/cpython that referenced this pull requestFeb 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 commitd7b5f10)Co-authored-by: James Morris <6653392+J-M0@users.noreply.github.com>
@bedevere-app
Copy link

GH-130674 is a backport of this pull request to the3.12 branch.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vsajipvsajipvsajip approved these changes

Assignees

@vsajipvsajip

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@J-M0@hugovk@vsajip@ZeroIntensity

[8]ページ先頭

©2009-2026 Movatter.jp