328 file_object.close() |
328 file_object.close() |
329 |
329 |
330 class ContentWriter(ContentHandler): |
330 class ContentWriter(ContentHandler): |
331 """ SAX Content writer. Parse and write an XML file. """ |
331 """ SAX Content writer. Parse and write an XML file. """ |
332 def __init__(self, op_sys, indent=""): |
332 def __init__(self, op_sys, indent=""): |
|
333 ContentHandler.__init__(self) |
333 self.os = op_sys |
334 self.os = op_sys |
334 self.indent = indent |
335 self.indent = indent |
335 self.__content = u"" |
336 self.__content = u"" |
336 |
337 |
337 def startElement(self, name, attrs): |
338 def startElement(self, name, attrs): |
338 """start Element""" |
339 """start Element""" |
339 self.os.write(self.indent + "<" + name) |
340 self.os.write(self.indent + "<" + name) |
340 if attrs.getLength() > 0: |
341 if attrs.getLength() > 0: |
341 self.os.write(" ") |
342 self.os.write(" ") |
342 self.os.write(" ".join(map(lambda x: "%s=\"%s\"" % (x, attrs.getValue(x)), attrs.getNames()))) |
343 self.os.write(" ".join(["%s=\"%s\"" % (x, attrs.getValue(x)) for x in attrs.getNames()])) |
343 self.os.write(">\n") |
344 self.os.write(">\n") |
344 self.indent += "\t" |
345 self.indent += "\t" |
345 self.__content = "" |
346 self.__content = "" |
346 |
347 |
347 def endElement(self, name): |
348 def endElement(self, name): |
383 |
384 |
384 outfile = codecs.open(summary + ".tmp", 'w', "utf8") |
385 outfile = codecs.open(summary + ".tmp", 'w', "utf8") |
385 parser = make_parser() |
386 parser = make_parser() |
386 parser.setContentHandler(AppendSummary(outfile, xmllog)) |
387 parser.setContentHandler(AppendSummary(outfile, xmllog)) |
387 |
388 |
388 input = open(summary, 'r') |
389 input_ = open(summary, 'r') |
389 parser.parse(input) |
390 parser.parse(input_) |
390 input.close() |
391 input_.close() |
391 outfile.close() |
392 outfile.close() |
392 # Updating the summary file. |
393 # Updating the summary file. |
393 os.unlink(summary) |
394 os.unlink(summary) |
394 os.rename(summary + ".tmp", summary) |
395 os.rename(summary + ".tmp", summary) |
395 |
396 |
396 |
397 |
397 def symbian_log_header(output, config, command, dir): |
398 def symbian_log_header(output, config, command, dir_): |
398 """symbian log header""" |
399 """symbian log header""" |
399 output.log("===-------------------------------------------------") |
400 output.log("===-------------------------------------------------") |
400 output.log("=== %s" % config) |
401 output.log("=== %s" % config) |
401 output.log("===-------------------------------------------------") |
402 output.log("===-------------------------------------------------") |
402 output.log("=== %s started %s" % (config, datetime.datetime.now().ctime())) |
403 output.log("=== %s started %s" % (config, datetime.datetime.now().ctime())) |
403 output.log("=== %s == %s" % (config, dir)) |
404 output.log("=== %s == %s" % (config, dir_)) |
404 output.log("-- %s" % command) |
405 output.log("-- %s" % command) |
405 output.log("++ Started at %s" % datetime.datetime.now().ctime()) |
406 output.log("++ Started at %s" % datetime.datetime.now().ctime()) |
406 output.log("+++ HiRes Start %f" % time.time()) |
407 output.log("+++ HiRes Start %f" % time.time()) |
407 output.log("Chdir %s" % dir) |
408 output.log("Chdir %s" % dir_) |
408 |
409 |
409 |
410 |
410 def symbian_log_footer(output): |
411 def symbian_log_footer(output): |
411 """symbian log footer""" |
412 """symbian log footer""" |
412 output.log("+++ HiRes End %f" % time.time()) |
413 output.log("+++ HiRes End %f" % time.time()) |