- Notifications
You must be signed in to change notification settings - Fork261
fix: fix problems with windows commands#942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
codejedi365 merged 11 commits intopython-semantic-release:masterfromJCHacking:fix_windows_build_commandJun 5, 2024
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
11 commits Select commitHold shift + click to select a range
0befe0e fix: problems with windows commands
JCHackingc91bad6 test: add windows environment variables in tests
JCHackingb7ff364 docs: add windows environment variables in documentation
JCHacking1c7bf76 refactor: extract get windows environment variables
JCHacking556cb9e chore: add all variables documented
JCHacking508f182 chore: only add windows environment variables in windows systems
JCHackingcec24a9 docs: add windows environment variables in documentation
jmencianaranjo-ionos397ae60 style: apply style in version.py
jmencianaranjo-ionosd5247d5 test: add tests for run command with windows
jmencianaranjo-ionos242f87e chore: use patched_os_environment and formated with ruff
jmencianaranjo-ionosf5cbef6 chore: use patched_os_environment and formated with ruff
jmencianaranjo-ionosFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletionsdocs/configuration.rst
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
37 changes: 37 additions & 0 deletionssemantic_release/cli/commands/version.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,6 +3,7 @@ | ||
| import logging | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| from contextlib import nullcontext | ||
| from datetime import datetime | ||
| from typing import TYPE_CHECKING | ||
| @@ -156,6 +157,40 @@ def shell( | ||
| ) | ||
| def is_windows() -> bool: | ||
| return sys.platform == "win32" | ||
| def get_windows_env() -> Mapping[str, str | None]: | ||
| return { | ||
| environment_variable: os.getenv(environment_variable, None) | ||
| for environment_variable in ( | ||
| "ALLUSERSAPPDATA", | ||
| "ALLUSERSPROFILE", | ||
| "APPDATA", | ||
| "COMMONPROGRAMFILES", | ||
| "COMMONPROGRAMFILES(x86)", | ||
| "DEFAULTUSERPROFILE", | ||
| "HOMEPATH", | ||
| "PATHEXT", | ||
| "PROFILESFOLDER", | ||
| "PROGRAMFILES", | ||
| "PROGRAMFILES(x86)", | ||
| "SYSTEM", | ||
| "SYSTEM16", | ||
| "SYSTEM32", | ||
| "SYSTEMDRIVE", | ||
| "SYSTEMPROFILE", | ||
| "SYSTEMROOT", | ||
| "TEMP", | ||
| "TMP", | ||
| "USERPROFILE", | ||
| "USERSID", | ||
| "WINDIR", | ||
| ) | ||
| } | ||
JCHacking marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| @click.command( | ||
| short_help="Detect and apply a new version", | ||
| context_settings={ | ||
| @@ -522,6 +557,8 @@ def version( # noqa: C901 | ||
| "PATH": os.getenv("PATH", ""), | ||
| "HOME": os.getenv("HOME", None), | ||
| "VIRTUAL_ENV": os.getenv("VIRTUAL_ENV", None), | ||
| # Windows environment variables | ||
| **(get_windows_env() if is_windows() else {}), | ||
| # affects build decisions | ||
| "CI": os.getenv("CI", None), | ||
| # Identifies which CI environment | ||
128 changes: 127 additions & 1 deletiontests/command_line/test_version.py
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
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.