]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
figleaf_htmlizer: emit stats to stdout, so buildbot can see it
authorBrian Warner <warner@lothar.com>
Thu, 12 Feb 2009 22:10:20 +0000 (15:10 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 12 Feb 2009 22:10:20 +0000 (15:10 -0700)
src/allmydata/util/figleaf_htmlizer.py

index 3851e93489c29f2a40d23502cfb86c3da0a17625..ac5946db4ff50e6a6c2107f32b7898110b8910c9 100644 (file)
@@ -146,15 +146,16 @@ class Renderer:
         pcnt_50 = [ x for x in pcnts if x >= 50 ]
 
         stats_fp = open('%s/stats.out' % (directory,), 'w')
-        stats_fp.write("total files: %d\n" % len(pcnts))
-        stats_fp.write("total source lines: %d\n" % summary_lines)
-        stats_fp.write("total covered lines: %d\n" % summary_cover)
-        stats_fp.write("total uncovered lines: %d\n" %
-                       (summary_lines - summary_cover))
+        self.write_stats(stats_fp, "total files: %d" % len(pcnts))
+        self.write_stats(stats_fp, "total source lines: %d" % summary_lines)
+        self.write_stats(stats_fp, "total covered lines: %d" % summary_cover)
+        self.write_stats(stats_fp,
+                         "total uncovered lines: %d" % (summary_lines - summary_cover))
         if self.old_coverage is not None:
-            stats_fp.write("lines added: %d\n" % summary_added)
-            stats_fp.write("lines removed: %d\n" % summary_removed)
-        stats_fp.write("total coverage percentage: %.1f\n" % summary_pcnt)
+            self.write_stats(stats_fp, "lines added: %d" % summary_added)
+            self.write_stats(stats_fp, "lines removed: %d" % summary_removed)
+        self.write_stats(stats_fp,
+                         "total coverage percentage: %.1f" % summary_pcnt)
         stats_fp.close()
 
         ## index.html
@@ -341,6 +342,10 @@ class Renderer:
         s = s.replace('"', "&quot;")
         return s
 
+    def write_stats(self, stats_fp, line):
+        stats_fp.write(line + "\n")
+        print line
+
 def main():
     r = Renderer()
     r.run()