summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-10-25 23:59:44 +0000
committerMarius Mauch <genone@gentoo.org>2007-10-25 23:59:44 +0000
commit447480ddb406b0e4f16e050bd5f7bbd6075194da (patch)
tree087683c0413f1a7d9193816ecdea7fb14535e462
parentf4ad0e861c866585392f57783fd4359c7ad4d6e8 (diff)
downloadportage-447480ddb406b0e4f16e050bd5f7bbd6075194da.tar.gz
portage-447480ddb406b0e4f16e050bd5f7bbd6075194da.tar.bz2
portage-447480ddb406b0e4f16e050bd5f7bbd6075194da.zip
Allow sets to contain non-atoms
svn path=/main/trunk/; revision=8300
-rw-r--r--pym/portage/sets/__init__.py8
-rw-r--r--pym/portage/sets/base.py9
2 files changed, 16 insertions, 1 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index b757c43c4..8497e1587 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -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")
diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py
index b5ea88928..1f3858137 100644
--- a/pym/portage/sets/base.py
+++ b/pym/portage/sets/base.py
@@ -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()