6 from optparse
import OptionParser
, OptionGroup
7 parser
= OptionParser("""\
8 usage: %prog [options] <path>
10 Utility for dumping Clang-style logged diagnostics.\
12 (opts
, args
) = parser
.parse_args()
15 parser
.error("invalid number of arguments")
19 # Read the diagnostics log.
26 # Complete the plist (the log itself is just the chunks).
28 <?xml version="1.0" encoding="UTF-8"?>
29 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
30 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
37 # Load the diagnostics.
38 diags
= plistlib
.readPlistFromString(data
)
40 # Print out the diagnostics.
42 print "**** BUILD DIAGNOSTICS ****"
43 for i
, file_diags
in enumerate(diags
):
44 file = file_diags
.get('main-file')
45 print "*** %s ***" % file
46 for d
in file_diags
.get('diagnostics', ()):
47 print "%s:%s:%s: %s: %s" % (
48 d
.get('filename'), d
.get('line'), d
.get('column'),
49 d
.get('level'), d
.get('message'))
51 if __name__
== "__main__":