nixos-rebuild-ng: enable upgrade lints
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
@@ -433,14 +433,14 @@ def list_generations(profile: Profile) -> list[GenerationJson]:
|
||||
)
|
||||
try:
|
||||
nixos_version = (generation_path / "nixos-version").read_text().strip()
|
||||
except IOError as ex:
|
||||
except OSError as ex:
|
||||
logger.debug("could not get nixos-version: %s", ex)
|
||||
nixos_version = "Unknown"
|
||||
try:
|
||||
kernel_version = next(
|
||||
(generation_path / "kernel-modules/lib/modules").iterdir()
|
||||
).name
|
||||
except IOError as ex:
|
||||
except OSError as ex:
|
||||
logger.debug("could not get kernel version: %s", ex)
|
||||
kernel_version = "Unknown"
|
||||
specialisations = [
|
||||
@@ -451,7 +451,7 @@ def list_generations(profile: Profile) -> list[GenerationJson]:
|
||||
[generation_path / "sw/bin/nixos-version", "--configuration-revision"],
|
||||
capture_output=True,
|
||||
).stdout.strip()
|
||||
except (CalledProcessError, IOError) as ex:
|
||||
except (OSError, CalledProcessError) as ex:
|
||||
logger.debug("could not get configuration revision: %s", ex)
|
||||
configuration_revision = "Unknown"
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@ import logging
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from getpass import getpass
|
||||
from typing import Final, Self, Sequence, TypedDict, Unpack
|
||||
from typing import Final, Self, TypedDict, Unpack
|
||||
|
||||
from . import tmpdir
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ ignore_missing_imports = true
|
||||
extend-select = [
|
||||
# ensure imports are sorted
|
||||
"I",
|
||||
# Automatically upgrade syntax for newer versions
|
||||
"UP",
|
||||
# require `check` argument for `subprocess.run`
|
||||
"PLW1510",
|
||||
# check for needless exception names in raise statements
|
||||
|
||||
Reference in New Issue
Block a user