summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-01-22 22:26:49 +0000
committerZac Medico <zmedico@gentoo.org>2009-01-22 22:26:49 +0000
commit52daa3dd5b5924952861a4da21c1dc61ee7c7673 (patch)
tree1b43baf135fec18b537ca76a6b762e3fc7b6c18a
parent96384612cb3e121e487367187e663198d6dfa4d8 (diff)
downloadportage-52daa3dd5b5924952861a4da21c1dc61ee7c7673.tar.gz
portage-52daa3dd5b5924952861a4da21c1dc61ee7c7673.tar.bz2
portage-52daa3dd5b5924952861a4da21c1dc61ee7c7673.zip
Add an ignore_priority parameter to digraph.parent_nodes().
svn path=/main/trunk/; revision=12551
-rw-r--r--pym/portage/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index a3acb91d1..5dbb982ab 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -459,16 +459,22 @@ class digraph(object):
def child_nodes(self, node, ignore_priority=None):
"""Return all children of the specified node"""
if ignore_priority is None:
- return self.nodes[node][0].keys()
+ return list(self.nodes[node][0])
children = []
for child, priority in self.nodes[node][0].iteritems():
if priority > ignore_priority:
children.append(child)
return children
- def parent_nodes(self, node):
+ def parent_nodes(self, node, ignore_priority=None):
"""Return all parents of the specified node"""
- return self.nodes[node][1].keys()
+ if ignore_priority is None:
+ return list(self.nodes[node][1])
+ parents = []
+ for parent, priority in self.nodes[node][1].iteritems():
+ if priority > ignore_priority:
+ parents.append(parent)
+ return parents
def leaf_nodes(self, ignore_priority=None):
"""Return all nodes that have no children