diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-14 00:30:51 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-14 00:30:51 +0000 |
commit | ab3703ae8663e428576114fbfb4946147608f7c5 (patch) | |
tree | afb640e186d1008bc74ff0a545e5b309a5588f8a | |
parent | f8658a9fd07f2b25f50b93b11e254212b92e1ea1 (diff) | |
download | portage-ab3703ae8663e428576114fbfb4946147608f7c5.tar.gz portage-ab3703ae8663e428576114fbfb4946147608f7c5.tar.bz2 portage-ab3703ae8663e428576114fbfb4946147608f7c5.zip |
In the slot collision display, show a maximum of 3 parents
for each package in order to avoid flooding the display.
svn path=/main/trunk/; revision=8500
-rw-r--r-- | pym/_emerge/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e2c657aa3..8df77b558 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1275,6 +1275,8 @@ class depgraph(object): "package slot have been \n") msg.append("!!! pulled into the dependency graph:\n\n") indent = " " + # Max number of parents shown, to avoid flooding the display. + max_parents = 3 for slot_atom, root in self._slot_collision_info: msg.append(slot_atom) msg.append("\n\n") @@ -1288,11 +1290,31 @@ class depgraph(object): msg.append(str(node)) parents = self._parent_child_digraph.parent_nodes(node) if parents: + omitted_parents = 0 + if len(parents) > max_parents: + omitted_parents = len(parents) - max_parents + pruned_list = [] + # When generating the pruned list, prefer instances + # of DependencyArg over instances of Package. + for parent in parents: + if isinstance(parent, DependencyArg): + pruned_list.append(parent) + if len(pruned_list) == max_parents: + break + for parent in parents: + if not isinstance(parent, DependencyArg): + pruned_list.append(parent) + if len(pruned_list) == max_parents: + break + parents = pruned_list msg.append(" pulled in by\n") for parent in parents: msg.append(2*indent) msg.append(str(parent)) msg.append("\n") + if omitted_parents: + msg.append(2*indent) + msg.append("(and %d more)\n" % omitted_parents) else: msg.append(" (no parents)\n") msg.append("\n") |