Tweak depgraph._show_unsatisfied_dep() display for AtomArg instances.
authorZac Medico <zmedico@gentoo.org>
Wed, 29 Sep 2010 20:43:08 +0000 (13:43 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 29 Sep 2010 20:43:08 +0000 (13:43 -0700)
pym/_emerge/depgraph.py

index 69422f9630f9329a8a9adeaf81372ece6594af39..857e6df20997667108e308a22e394b02941b4f24 100644 (file)
@@ -2122,6 +2122,8 @@ class depgraph(object):
                xinfo = '"%s"' % atom.unevaluated_atom
                if arg:
                        xinfo='"%s"' % arg
+               if isinstance(myparent, AtomArg):
+                       xinfo = _unicode_decode('"%s"') % (myparent,)
                # Discard null/ from failed cpv_expand category expansion.
                xinfo = xinfo.replace("null/", "")
                masked_packages = []
@@ -2375,6 +2377,12 @@ class depgraph(object):
                # Show parent nodes and the argument that pulled them in.
                traversed_nodes = set()
                node = myparent
+               if isinstance(myparent, AtomArg):
+                       # It's redundant to show parent for AtomArg since
+                       # it's the same as 'xinfo' displayed above.
+                       node = None
+               else:
+                       node = myparent
                msg = []
                while node is not None:
                        traversed_nodes.add(node)
@@ -2408,8 +2416,9 @@ class depgraph(object):
                                else:
                                        selected_parent = parent
                        node = selected_parent
-               writemsg_stdout("\n".join(msg), noiselevel=-1)
-               writemsg_stdout("\n", noiselevel=-1)
+               if msg:
+                       writemsg_stdout("\n".join(msg), noiselevel=-1)
+                       writemsg_stdout("\n", noiselevel=-1)
 
                if mask_docs:
                        show_mask_docs()