summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portato/backend/portage/system.py6
-rw-r--r--portato/backend/portage/system_22.py6
-rw-r--r--portato/backend/system_interface.py15
3 files changed, 27 insertions, 0 deletions
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index feaf4df..58f687e 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -37,6 +37,12 @@ class PortageSystem (SystemInterface):
self.use_descs = {}
self.local_use_descs = defaultdict(dict)
+ def has_set_support (self):
+ return False
+
+ def get_sets (self):
+ return (("world", "The world set."), ("system", "The system set."))
+
def get_version (self):
return "Portage %s" % portage.VERSION
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
index be27186..88d968b 100644
--- a/portato/backend/portage/system_22.py
+++ b/portato/backend/portage/system_22.py
@@ -30,5 +30,11 @@ class PortageSystem_22 (PortageSystem):
self.use_descs = {}
self.local_use_descs = defaultdict(dict)
+ def has_set_support (self):
+ return True
+
+ def get_sets (self):
+ return ((name, set.description) for name, set in self.settings.setsconfig.getSets().iteritems())
+
def new_package (self, cpv):
return PortagePackage_22(cpv)
diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py
index 4b0f8df..16f0a9c 100644
--- a/portato/backend/system_interface.py
+++ b/portato/backend/system_interface.py
@@ -12,6 +12,21 @@
class SystemInterface (object):
+ def has_set_support (self):
+ """Signals, whether this backend supports sets.
+
+ @rtype: boolean
+ """
+ raise NotImplementedError
+
+ def get_sets (self):
+ """Returns all supported sets in tuples consisting of name and description.
+ If sets aren't supported, at least "world" and "system" have to be returned.
+
+ @rtype: (string, string)[]
+ """
+ raise NotImplementedError
+
def get_version (self):
"""Returns the version of the used backend.