[pypy-svn] r38286 - pypy/dist/pypy/tool

hpk at codespeak.net hpk at codespeak.net
Fri Feb 9 18:51:31 CET 2007


Author: hpk
Date: Fri Feb  9 18:51:29 2007
New Revision: 38286

Modified:
   pypy/dist/pypy/tool/genstatistic.py
Log:
using a default of curdir.join("index.html" 
for generating statistics and fixing xml escaping
issues. 


Modified: pypy/dist/pypy/tool/genstatistic.py
==============================================================================
--- pypy/dist/pypy/tool/genstatistic.py	(original)
+++ pypy/dist/pypy/tool/genstatistic.py	Fri Feb  9 18:51:29 2007
@@ -2,6 +2,7 @@
 import autopath
 import py
 from py.__.misc.cmdline import countloc 
+from py.xml import raw
 
 pypydir = py.path.local(autopath.pypydir)
 
@@ -67,13 +68,13 @@
 
 def viewlocsummary(model):
     t = html.table(
-        row("total number of lines", model.totallines, " "), 
+        row("total number of lines", model.totallines, raw(" ")), 
         row("number of testlines", model.testlines, 
             percent(model.testlines, model.totallines)), 
         row("number of non-testlines", model.notestlines, 
             percent(model.notestlines, model.totallines)), 
 
-        row("total number of files", model.totalfiles, " "), 
+        row("total number of files", model.totalfiles, raw(" ")), 
         row("number of testfiles", model.testfiles, 
             percent(model.testfiles, model.totalfiles)), 
         row("number of non-testfiles", model.notestfiles, 
@@ -112,6 +113,11 @@
     return t
 
 if __name__ == '__main__': 
+    if len(py.std.sys.argv) >= 2:
+        target = py.path.local(py.std.sys.argv[1])
+    else:
+        target = py.path.local('index.html')
+    print "writing source statistics to", target
     pypycounter = getpypycounter() 
     model = CounterModel(pypycounter) 
     rev = py.path.svnwc(autopath.pypydir).info().rev
@@ -130,4 +136,6 @@
             html.p("files with less than 3 lines ignored")
         )
     )
-    print doc.unicode(indent=2).encode('utf8')
+    content = doc.unicode(indent=2).encode('utf8')
+    target.write(content)
+



More information about the Pypy-commit mailing list