summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-07-09 23:15:14 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-07-09 23:15:14 +0200
commitc592c0a400099e442508ec09284e188d03fb5444 (patch)
treebedd6f8053f1f5d84c9448508471af3b21937c91 /portato/backend
parenteb87d40f4056e05f38609fc5e8482e21a7a4c42e (diff)
downloadportato-c592c0a400099e442508ec09284e188d03fb5444.tar.gz
portato-c592c0a400099e442508ec09284e188d03fb5444.tar.bz2
portato-c592c0a400099e442508ec09284e188d03fb5444.zip
Added package sets of portage-2.2
Diffstat (limited to '')
-rw-r--r--portato/backend/portage/sets.py17
-rw-r--r--portato/backend/portage/system_22.py18
2 files changed, 35 insertions, 0 deletions
diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py
index 2305c85..7984d3d 100644
--- a/portato/backend/portage/sets.py
+++ b/portato/backend/portage/sets.py
@@ -14,7 +14,14 @@ from __future__ import absolute_import, with_statement
import re
+import portage
+try:
+ import portage.dep as portage_dep
+except ImportError:
+ import portage_dep
+
from .. import system
+from ...helper import debug
class Set(object):
@@ -57,6 +64,15 @@ class FilterSet (Set):
return t
+class PortageSet (FilterSet):
+ def __init__ (self, name):
+ FilterSet.__init__(self)
+ debug("Loading portage set '%s'", name)
+ self.portageSet = system.settings.setsconfig.getSets()[name]
+
+ def get_list(self):
+ return self.portageSet.getAtoms()
+
class SystemSet (FilterSet):
def get_list(self):
@@ -126,3 +142,4 @@ class UninstalledSet (Set):
def find (self, *args, **kwargs):
return self.all.find(*args, **kwargs) - self.installed.find(*args, **kwargs)
+
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
index 289849c..18e3b4e 100644
--- a/portato/backend/portage/system_22.py
+++ b/portato/backend/portage/system_22.py
@@ -20,6 +20,7 @@ from collections import defaultdict
from .package_22 import PortagePackage_22
from .settings_22 import PortageSettings_22
from .system import PortageSystem
+from . import sets as syssets
class PortageSystem_22 (PortageSystem):
@@ -30,6 +31,13 @@ class PortageSystem_22 (PortageSystem):
self.use_descs = {}
self.local_use_descs = defaultdict(dict)
+ self.setmap = {
+ self.SET_ALL : syssets.AllSet,
+ self.SET_INSTALLED : syssets.InstalledSet,
+ self.SET_UNINSTALLED : syssets.UninstalledSet,
+ self.SET_TREE : syssets.TreeSet
+ }
+
def has_set_support (self):
return True
@@ -39,5 +47,15 @@ class PortageSystem_22 (PortageSystem):
else:
return tuple(self.settings.setsconfig.getSets())
+ def _get_set (self, pkgSet):
+ pkgSet = pkgSet.lower()
+ if pkgSet == "": pkgSet = self.SET_ALL
+
+ s = self.setmap.get(pkgSet, None)
+ if s is None:
+ return syssets.PortageSet(pkgSet)
+ else:
+ return s()
+
def new_package (self, cpv):
return PortagePackage_22(cpv)