Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.nox: apply backport for wntrblm/nox#903 #365251

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/development/python-modules/nox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ buildPythonPackage rec {
hash = "sha256-GdNz34A8IKwPG/270sY5t3SoggGCZMWfDq/Wyhk0ez8=";
};

patches = [
kirillrdy marked this conversation as resolved.
Show resolved Hide resolved
# Backport of https://github.com/wntrblm/nox/pull/903, which can be removed on next release
./fix-broken-mock-on-cpython-3.12.8.patch
];

build-system = [ hatchling ];

dependencies =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/nox/command.py b/nox/command.py
index 671875c..4984168 100644
--- a/nox/command.py
+++ b/nox/command.py
@@ -30,6 +30,8 @@ TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import IO

+_PLATFORM = sys.platform
+
ExternalType = Literal["error", True, False]


@@ -63,7 +65,7 @@ def _clean_env(env: Mapping[str, str | None] | None = None) -> dict[str, str] |
clean_env = {k: v for k, v in env.items() if v is not None}

# Ensure systemroot is passed down, otherwise Windows will explode.
- if sys.platform == "win32":
+ if _PLATFORM.startswith("win"):
clean_env.setdefault("SYSTEMROOT", os.environ.get("SYSTEMROOT", ""))

return clean_env
diff --git a/tests/test_command.py b/tests/test_command.py
index ae398e9..904cf34 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -157,7 +157,7 @@ def test_run_env_remove(monkeypatch):
)


-@mock.patch("sys.platform", "win32")
+@mock.patch("nox.command._PLATFORM", "win32")
def test_run_env_systemroot():
systemroot = os.environ.setdefault("SYSTEMROOT", "sigil")

Loading