Optimize order for --tree display of circular dependencies.
authorZac Medico <zmedico@gentoo.org>
Mon, 19 Feb 2007 07:33:24 +0000 (07:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 19 Feb 2007 07:33:24 +0000 (07:33 -0000)
svn path=/main/trunk/; revision=6014

pym/emerge/__init__.py

index 5567bb3e0edc1a0d39d08a42cd7f84bfa0ec9776..50e91d64c5ab0e3be9f773c761e77fe95c4ba7a0 100644 (file)
@@ -2101,10 +2101,21 @@ class depgraph:
                                # Display the USE flags that are enabled on nodes that are part
                                # of dependency cycles in case that helps the user decide to
                                # disable some of them.
+                               display_order = []
+                               tempgraph = mygraph.copy()
+                               while not tempgraph.empty():
+                                       nodes = tempgraph.leaf_nodes()
+                                       if not nodes:
+                                               node = tempgraph.order[0]
+                                       else:
+                                               node = nodes[0]
+                                       display_order.append(list(node))
+                                       tempgraph.remove(node)
+                               display_order.reverse()
                                self.myopts.pop("--quiet", None)
                                self.myopts.pop("--verbose", None)
                                self.myopts["--tree"] = True
-                               self.display([list(node) for node in mygraph.order])
+                               self.display(display_order)
                                print "!!! Error: circular dependencies:"
                                print
                                mygraph.debug_print()