From 51bbfaa71063c4cb5550bdf7413895e5b22689d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 7 Feb 2025 08:04:50 +0700 Subject: [PATCH] nixos-rebuild-ng: don't shadow builtins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörg Thalheim --- pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py | 4 ++-- .../ni/nixos-rebuild-ng/src/nixos_rebuild/process.py | 6 +++--- pkgs/by-name/ni/nixos-rebuild-ng/src/pyproject.toml | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py index f14d3d0a09a9..79048f83e7fd 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py @@ -583,7 +583,7 @@ def switch_to_configuration( ) -def upgrade_channels(all: bool = False) -> None: +def upgrade_channels(all_channels: bool = False) -> None: """Upgrade channels for classic Nix. It will either upgrade just the `nixos` channel (including any channel @@ -591,7 +591,7 @@ def upgrade_channels(all: bool = False) -> None: """ for channel_path in Path("/nix/var/nix/profiles/per-user/root/channels/").glob("*"): if channel_path.is_dir() and ( - all + all_channels or channel_path.name == "nixos" or (channel_path / ".update-on-nixos-rebuild").exists() ): diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/process.py b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/process.py index dacedeba406c..de37bd615512 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/process.py +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/process.py @@ -92,7 +92,7 @@ def run_wrapper( ) -> subprocess.CompletedProcess[str]: "Wrapper around `subprocess.run` that supports extra functionality." env = None - input = None + process_input = None if remote: if extra_env: extra_env_args = [f"{env}={value}" for env, value in extra_env.items()] @@ -100,7 +100,7 @@ def run_wrapper( if sudo: if remote.sudo_password: args = ["sudo", "--prompt=", "--stdin", *args] - input = remote.sudo_password + "\n" + process_input = remote.sudo_password + "\n" else: args = ["sudo", *args] args = [ @@ -133,7 +133,7 @@ def run_wrapper( args, check=check, env=env, - input=input, + input=process_input, # Hope nobody is using NixOS with non-UTF8 encodings, but "surrogateescape" # should still work in those systems. text=True, diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/pyproject.toml b/pkgs/by-name/ni/nixos-rebuild-ng/src/pyproject.toml index 9fc89eb07567..863830562e6f 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/pyproject.toml +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/pyproject.toml @@ -39,6 +39,8 @@ ignore_missing_imports = true [tool.ruff.lint] extend-select = [ + # don't shadow built-in names + "A", # ensure imports are sorted "I", # Automatically upgrade syntax for newer versions