Allow sets to contain non-atoms
authorMarius Mauch <genone@gentoo.org>
Thu, 25 Oct 2007 23:59:44 +0000 (23:59 -0000)
committerMarius Mauch <genone@gentoo.org>
Thu, 25 Oct 2007 23:59:44 +0000 (23:59 -0000)
svn path=/main/trunk/; revision=8300

pym/portage/sets/__init__.py
pym/portage/sets/base.py

index b757c43c47c5972d66f29f1ff27aa7e3ca033021..8497e15874fb34b35d65575bb91be80995978ef4 100644 (file)
@@ -92,6 +92,14 @@ class SetConfig(SafeConfigParser):
                        self.aliases = shortnames
                return self.aliases
 
+       def getSetAtoms(self, setname):
+               myset = self.getSetsWithAliases()[setname]
+               myatoms = myset.getAtoms()
+               for n in myset.getNonAtoms():
+                       if n in self.aliases:
+                               myatoms.update(self.getSetAtoms(n))
+               return myatoms
+
 def make_default_config(settings, trees):
        sc = SetConfig([], settings, trees)
        sc.add_section("security")
index b5ea889286028f0571f6b706ec972d0137904e3d..1f385813767a1647bc7a81261d0737f0d1033502 100644 (file)
@@ -23,6 +23,7 @@ class PackageSet(object):
                self._loaded = False
                self._loading = False
                self.errors = []
+               self._nonatoms = set()
 
        def __contains__(self, atom):
                return atom in self.getAtoms()
@@ -44,13 +45,19 @@ class PackageSet(object):
                        self._loading = False
                return self._atoms
 
+       def getNonAtoms(self):
+               self.getAtoms()
+               return self._nonatoms
+
        def _setAtoms(self, atoms):
                atoms = map(str.strip, atoms)
+               nonatoms = set()
                for a in atoms[:]:
                        if a == "":
                                atoms.remove(a)
                        elif not isvalidatom(a):
-                               raise InvalidAtom(a)
+                               atoms.remove(a)
+                               self._nonatoms.add(a)
                self._atoms = set(atoms)
                self._updateAtomMap()