def genhtml(infofile, basepath, outdir): tracefile = TracefileParser(infofile, basepath) toplevel = os.path.join(outdir, 'index.html') with open(toplevel, 'w') as f: f.write(front_page(tracefile)) with open(os.path.join(outdir, 'style.css'), 'w') as f: f.write(stylesheet()) for directory in tracefile.list_dirs(): dirname = os.path.join(outdir, directory[1:]) if not os.path.isdir(dirname): os.makedirs(dirname) with open(os.path.join(dirname, 'index.html'), 'w') as f: f.write(directory_page(tracefile, toplevel, directory)) with open(os.path.join(dirname, 'style.css'), 'w') as f: f.write(stylesheet()) for filename in tracefile.list_files(directory): with open(os.path.join(dirname, filename + '.html'), 'w') as f: f.write(file_page(tracefile, toplevel, directory, filename))
import sys sys.path.append('.') from gcov.parser import TracefileParser if __name__ == '__main__': tp = TracefileParser(sys.argv[1]) print tp.full_statistics() for directory in tp.list_dirs(): print tp.full_statistics(directory) for filename in tp.list_files(directory): print tp.full_statistics(directory, filename)