aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2024-03-06 14:43:03 -0500
committerSam James <sam@gentoo.org>2024-03-07 15:08:04 +0000
commit5c8f8d79a8b6179e50b2eb955eb848096727a9ac (patch)
tree6152d17e3b2421799cfc11e73c17de8197dd18cf
parenteclean/search.py: Fix find_packages docstring for invalid_paths (diff)
downloadgentoolkit-5c8f8d79a8b6179e50b2eb955eb848096727a9ac.tar.gz
gentoolkit-5c8f8d79a8b6179e50b2eb955eb848096727a9ac.tar.bz2
gentoolkit-5c8f8d79a8b6179e50b2eb955eb848096727a9ac.zip
dependencies.py: use Enum rather than StrEnum for DependencyKind
StrEnum is only supported in Python versions 3.11 and newer. Gentoolkit should not require >=3.11, so DependencyKind will use the regular Enum feature instead. The difference between StrEnum and Enum is that StrEnum members are strings and can generally be used in place of strings in APIs expecting string input. Non-StrEnum members are not strings, but you can get members values by accessing their value field (DependencyKind.DEPEND.value). Fixes: 78464ec40bad9a0f824b063506f58296cc3ed9f3 Signed-off-by: John Turner <jturner.usa@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/46 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--pym/gentoolkit/dependencies.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index f296e27..c6abff0 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -13,7 +13,7 @@ __all__ = ("Dependencies",)
import itertools
from functools import cache
-from enum import StrEnum
+from enum import Enum
from typing import List, Dict
import portage
@@ -28,7 +28,7 @@ from gentoolkit.query import Query
# =======
-class DependencyKind(StrEnum):
+class DependencyKind(Enum):
DEPEND = "DEPEND"
RDEPEND = "RDEPEND"
BDEPEND = "BDEPEND"
@@ -104,13 +104,13 @@ class Dependencies(Query):
@cache
def get_raw_depends(self) -> str:
- return self._get_depend([depkind for depkind in DependencyKind], raw=True)
+ return self._get_depend([depkind.value for depkind in DependencyKind], raw=True)
@cache
def get_depends(self) -> Dict[DependencyKind, List[Atom]]:
depends = dict()
for depkind in DependencyKind:
- depend = self._get_depend([depkind])
+ depend = self._get_depend([depkind.value])
depends[depkind] = depend
return depends