From 30724593fc383ab7cb9c199e48887cb7e5dec86f Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 12 Feb 2009 15:10:20 -0700 Subject: [PATCH] figleaf_htmlizer: emit stats to stdout, so buildbot can see it --- src/allmydata/util/figleaf_htmlizer.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/allmydata/util/figleaf_htmlizer.py b/src/allmydata/util/figleaf_htmlizer.py index 3851e934..ac5946db 100644 --- a/src/allmydata/util/figleaf_htmlizer.py +++ b/src/allmydata/util/figleaf_htmlizer.py @@ -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('"', """) return s + def write_stats(self, stats_fp, line): + stats_fp.write(line + "\n") + print line + def main(): r = Renderer() r.run() -- 2.45.2