diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-26 20:26:25 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-26 20:26:25 +0200 |
commit | 1898e03577eac27a8e27561eda952647643ec69b (patch) | |
tree | 5557b891f78e03063d13af1bb7545414118ddade /portato | |
parent | 9f820103c30e89376a0484c614d2bbc068998e48 (diff) | |
download | portato-1898e03577eac27a8e27561eda952647643ec69b.tar.gz portato-1898e03577eac27a8e27561eda952647643ec69b.tar.bz2 portato-1898e03577eac27a8e27561eda952647643ec69b.zip |
Added very basic set querying
Diffstat (limited to '')
-rw-r--r-- | portato/backend/portage/system.py | 6 | ||||
-rw-r--r-- | portato/backend/portage/system_22.py | 6 | ||||
-rw-r--r-- | portato/backend/system_interface.py | 15 |
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. |