[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/utils.py In case of profile steps with problems. The code will emit warnings

Patrick Gerken do3ccqrv at gmail.com
Mon Aug 30 06:53:33 EDT 2010


Log message for revision 116022:
  In case of profile steps with problems. The code will emit warnings
  
  Also, the warning contains a graphiz parsable output that
  illustrates the dependencies and highlights the graph.
  

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/utils.py

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/utils.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/utils.py	2010-08-30 08:52:48 UTC (rev 116021)
+++ Products.GenericSetup/trunk/Products/GenericSetup/utils.py	2010-08-30 10:53:32 UTC (rev 116022)
@@ -19,6 +19,7 @@
 import sys
 from cgi import escape
 from inspect import getdoc
+from logging import getLogger
 from xml.dom.minidom import _nssplit
 from xml.dom.minidom import Document
 from xml.dom.minidom import Element
@@ -852,6 +853,20 @@
             # Nothing was resolved in this loop. There must be circular or
             # missing dependencies. Just add them to the end. We can't
             # raise an error, because checkComplete relies on this method.
+            logger = getLogger('GenericSetup')
+            log_msg = 'There are unresolved or circular dependencies. '\
+                      'Graphiz diagram:: digraph dependencies {'
+            for step in steps:
+                step_id = step['id']
+                for dependency in step['dependencies']:
+                    log_msg += '"%s" -> "%s"; ' % (step_id, dependency)
+                if not step['dependencies']:
+                    log_msg += '"%s";' % step_id
+            for unresolved_key, ignore in unresolved:
+                log_msg += '"%s" [color=red,style=filled]; ' % unresolved_key
+            log_msg += '}'
+            logger.warning(log_msg)
+
             for node, edges in unresolved:
                 result.append(node)
             break



More information about the checkins mailing list