vermin: don't use StrEnum (MR 2252)

It was only introduced in 3.11. Instead just define __str__() manually
for the Enums where it's needed.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-15 18:55:03 +02:00 committed by Oliver Smith
parent 4108b95d72
commit 30fde53279
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 8 additions and 2 deletions

View file

@ -62,7 +62,7 @@ def abuild_overrides(apkbuild: Path):
pmb.helpers.run.root(["sh", "-c", f"cat {override_path} >> {apkbuild}"])
class BuildStatus(enum.StrEnum):
class BuildStatus(enum.Enum):
# The binary package is outdated
OUTDATED = "outdated"
# There is no binary package
@ -72,6 +72,9 @@ class BuildStatus(enum.StrEnum):
# Building isn't needed
UNNECESSARY = "unnecessary"
def __str__(self) -> str:
return self.value
def necessary(self):
return self in [BuildStatus.OUTDATED, BuildStatus.NEW]

View file

@ -26,11 +26,14 @@ class SystemdConfig(enum.Enum):
return [e.value for e in SystemdConfig]
class AutoZapConfig(enum.StrEnum):
class AutoZapConfig(enum.Enum):
NO = "no"
YES = "yes"
SILENTLY = "silently"
def __str__(self) -> str:
return self.value
def enabled(self) -> bool:
return self != AutoZapConfig.NO