summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-10-18 20:30:00 +0000
committerZac Medico <zmedico@gentoo.org>2009-10-18 20:30:00 +0000
commit4cde669571f3eba5768636e299063a8b0334a3dd (patch)
treedf4f47c95200ce3c43ee4b1c9262b86eb448ff8c
parent119b90dbd62a46764eace707cb14c051407a41bd (diff)
downloadportage-4cde669571f3eba5768636e299063a8b0334a3dd.tar.gz
portage-4cde669571f3eba5768636e299063a8b0334a3dd.tar.bz2
portage-4cde669571f3eba5768636e299063a8b0334a3dd.zip
Add a boolean expand_nested_sets parameter to SetConfig.getSetAtoms(). This
will be useful for adding support to the dependency graph for keeping track of precisely which nested set each atom comes from. svn path=/main/trunk/; revision=14677
-rw-r--r--pym/portage/sets/__init__.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index ab67642b8..1adcacadb 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -144,7 +144,7 @@ class SetConfig(object):
self._parse()
return self.psets.copy()
- def getSetAtoms(self, setname, ignorelist=None):
+ def getSetAtoms(self, setname, ignorelist=None, expand_nested_sets=True):
"""
This raises PackageSetNotFound if the give setname does not exist.
"""
@@ -158,7 +158,7 @@ class SetConfig(object):
extend = set()
remove = set()
intersect = set()
-
+
if ignorelist is None:
ignorelist = set()
@@ -171,27 +171,32 @@ class SetConfig(object):
remove.update(parser.get(myset.creator, "remove").split())
if parser.has_option(myset.creator, "intersect"):
intersect.update(parser.get(myset.creator, "intersect").split())
-
+
ignorelist.add(setname)
- for n in myset.getNonAtoms():
- if n.startswith(SETPREFIX):
- s = n[len(SETPREFIX):]
- if s in self.psets:
- extend.add(n[len(SETPREFIX):])
- else:
- raise PackageSetNotFound(s)
+
+ if expand_nested_sets:
+ for n in myset.getNonAtoms():
+ if n.startswith(SETPREFIX):
+ s = n[len(SETPREFIX):]
+ if s in self.psets:
+ extend.add(n[len(SETPREFIX):])
+ else:
+ raise PackageSetNotFound(s)
for s in ignorelist:
extend.discard(s)
remove.discard(s)
intersect.discard(s)
-
+
for s in extend:
- myatoms.update(self.getSetAtoms(s, ignorelist=ignorelist))
+ myatoms.update(self.getSetAtoms(s,
+ ignorelist=ignorelist, expand_nested_sets=expand_nested_sets))
for s in remove:
- myatoms.difference_update(self.getSetAtoms(s, ignorelist=ignorelist))
+ myatoms.difference_update(self.getSetAtoms(s,
+ ignorelist=ignorelist, expand_nested_sets=expand_nested_sets))
for s in intersect:
- myatoms.intersection_update(self.getSetAtoms(s, ignorelist=ignorelist))
+ myatoms.intersection_update(self.getSetAtoms(s,
+ ignorelist=ignorelist, expand_nested_sets=expand_nested_sets))
return myatoms