aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2024-01-24 18:31:11 -0500
committerSam James <sam@gentoo.org>2024-02-16 20:12:48 +0000
commit78464ec40bad9a0f824b063506f58296cc3ed9f3 (patch)
tree6ea18288f699ddd16ff7b857944500eb6fee048e
parenteclean: handle when git3-src doesn't exist (port to Pathlib) (diff)
downloadgentoolkit-78464ec40bad9a0f824b063506f58296cc3ed9f3.tar.gz
gentoolkit-78464ec40bad9a0f824b063506f58296cc3ed9f3.tar.bz2
gentoolkit-78464ec40bad9a0f824b063506f58296cc3ed9f3.zip
dependencies.py: create DependencyKind enum
The DependencyKind enum allows iterating over the different dependency kinds and represents each dependency kind as a type. This could later be used in APIs for selecting specific dependency kinds in queries. Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--pym/gentoolkit/dependencies.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index 8dd4867..dd30312 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -11,6 +11,8 @@ __all__ = ("Dependencies",)
# Imports
# =======
+from enum import StrEnum
+
import portage
from portage.dep import paren_reduce
@@ -24,6 +26,14 @@ from gentoolkit.query import Query
# =======
+class DependencyKind(StrEnum):
+ DEPEND = "DEPEND"
+ RDEPEND = "RDEPEND"
+ BDEPEND = "BDEPEND"
+ PDEPEND = "PDEPEND"
+ IDEPEND = "IDEPEND"
+
+
class Dependencies(Query):
"""Access a package's dependencies and reverse dependencies.