nixos-rebuild-ng: don't shadow builtins
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
@@ -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()
|
||||
):
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user