From 447480ddb406b0e4f16e050bd5f7bbd6075194da Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Thu, 25 Oct 2007 23:59:44 +0000 Subject: [PATCH] Allow sets to contain non-atoms svn path=/main/trunk/; revision=8300 --- pym/portage/sets/__init__.py | 8 ++++++++ pym/portage/sets/base.py | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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() -- 2.26.2