forked from Mirror/pmbootstrap
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:
parent
4108b95d72
commit
30fde53279
2 changed files with 8 additions and 2 deletions
|
@ -62,7 +62,7 @@ def abuild_overrides(apkbuild: Path):
|
||||||
pmb.helpers.run.root(["sh", "-c", f"cat {override_path} >> {apkbuild}"])
|
pmb.helpers.run.root(["sh", "-c", f"cat {override_path} >> {apkbuild}"])
|
||||||
|
|
||||||
|
|
||||||
class BuildStatus(enum.StrEnum):
|
class BuildStatus(enum.Enum):
|
||||||
# The binary package is outdated
|
# The binary package is outdated
|
||||||
OUTDATED = "outdated"
|
OUTDATED = "outdated"
|
||||||
# There is no binary package
|
# There is no binary package
|
||||||
|
@ -72,6 +72,9 @@ class BuildStatus(enum.StrEnum):
|
||||||
# Building isn't needed
|
# Building isn't needed
|
||||||
UNNECESSARY = "unnecessary"
|
UNNECESSARY = "unnecessary"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return self.value
|
||||||
|
|
||||||
def necessary(self):
|
def necessary(self):
|
||||||
return self in [BuildStatus.OUTDATED, BuildStatus.NEW]
|
return self in [BuildStatus.OUTDATED, BuildStatus.NEW]
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,14 @@ class SystemdConfig(enum.Enum):
|
||||||
return [e.value for e in SystemdConfig]
|
return [e.value for e in SystemdConfig]
|
||||||
|
|
||||||
|
|
||||||
class AutoZapConfig(enum.StrEnum):
|
class AutoZapConfig(enum.Enum):
|
||||||
NO = "no"
|
NO = "no"
|
||||||
YES = "yes"
|
YES = "yes"
|
||||||
SILENTLY = "silently"
|
SILENTLY = "silently"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return self.value
|
||||||
|
|
||||||
def enabled(self) -> bool:
|
def enabled(self) -> bool:
|
||||||
return self != AutoZapConfig.NO
|
return self != AutoZapConfig.NO
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue