#! /usr/bin/env python import sys import re import xml.etree.cElementTree as ET root = "ex1/" pat = re.compile("^.*" + root) buildlog = ET.parse(sys.argv[1]) html = ET.XML(""" Triggered makefiles

Triggered makefiles

makelevel pwd start time end time
""") table = html.find("./body/table") for ml in buildlog.findall("//makelog"): tr = ET.SubElement(table, "tr") ET.SubElement(tr, "td").text = ml.findtext("makeinfo/makelevel") ET.SubElement(tr, "td").text = pat.sub("", ml.findtext("makeinfo/pwd")) ET.SubElement(tr, "td").text = ml.findtext("makeinfo/stime")[11:22] ET.SubElement(tr, "td").text = ml.findtext("makeinfo/etime")[11:22] ET.ElementTree(html).write("makefiles.html")