[Checkins] SVN: zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py Nicer report formatting, exit(-1) if any bugs languish.

Tres Seaver tseaver at palladion.com
Wed Apr 14 16:35:56 EDT 2010


Log message for revision 110915:
  Nicer report formatting, exit(-1) if any bugs languish.

Changed:
  U   zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py

-=-
Modified: zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py
===================================================================
--- zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py	2010-04-14 20:32:42 UTC (rev 110914)
+++ zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py	2010-04-14 20:35:55 UTC (rev 110915)
@@ -78,7 +78,7 @@
     def __init__(self, launchpad, project, report_date, states, verbose):
         """Log into launchpad and get the Zope 3 project
         """
-        self.project = project
+        self.project_name = project
         self.report_date = report_date
         self.states = states
         self.verbose = verbose
@@ -103,14 +103,19 @@
     def report(self):
         """Return a printable summary
         """
-        lines = ['Languishing bugs for: %s' % self.project]
+        count = len(self.bugs)
+        lines = ['-' * 78 +
+                 '\n%-40s: languishing bugs: %d\n'
+                    % (self.project_name, count) +
+                 '-' * 78
+                ]
         for bug in self.bugs:
             if self.verbose:
                 fmt = '%(title)s\n %(status)s %(created)s\n %(link)s'
             else:
                 fmt = '%(title)s\n %(link)s'
             lines.append(fmt % bug)
-        return "\n\n".join(lines)
+        return count, "\n\n".join(lines)
 
 def get_projects_from_group(launchpad, project_group):
     group = launchpad.project_groups[project_group]
@@ -170,10 +175,20 @@
     if not states:
         states.append('New')
 
+    total = 0
     for project in projects:
         Tracker = BugTracker(launchpad, project, report_date, states, verbose)
         Tracker.get()
-        print Tracker.report()
+        count, text = Tracker.report()
+        total += count
+        print text
 
+    print '=' * 78
+    print 'Total:  %d' % total
+    print '=' * 78
+
+    if total > 0:
+        sys.exit(-1)
+
 if __name__ == '__main__':
     main()



More information about the checkins mailing list