4 # All rights reserved. |
4 # All rights reserved. |
5 # This component and the accompanying materials are made available |
5 # This component and the accompanying materials are made available |
6 # under the terms of the License "Symbian Foundation License v1.0" |
6 # under the terms of the License "Symbian Foundation License v1.0" |
7 # which accompanies this distribution, and is available |
7 # which accompanies this distribution, and is available |
8 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
8 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
9 # |
9 |
10 # Initial Contributors: |
10 ''' |
11 # Nokia Corporation - initial contribution. |
11 Tie together a set of HTML build summaries by creating a single index page |
12 # |
12 which shows the total number of Errors, Warnings etc. across all the parts |
13 # Contributors: |
13 of the build and links to the individual summaries. |
14 # |
14 ''' |
15 # Description: |
|
16 # |
|
17 # Tie together a set of HTML build summaries by creating a single index page |
|
18 # which shows the total number of Errors, Warnings etc. across all the parts |
|
19 # of the build and links to the individual summaries. |
|
20 |
15 |
21 import os |
16 import os |
22 import sys |
17 import sys |
|
18 import time |
23 |
19 |
24 # get the absolute path to this script |
20 # get the absolute path to this script |
25 script = os.path.abspath(sys.argv[0]) |
21 script = os.path.abspath(sys.argv[0]) |
26 bindir = os.path.dirname(script) |
22 bindir = os.path.dirname(script) |
27 # add the Raptor python and plugins directories to the PYTHONPATH |
23 # add the Raptor python and plugins directories to the PYTHONPATH |
102 try: |
98 try: |
103 reader = csv.reader(open(t, "rb")) |
99 reader = csv.reader(open(t, "rb")) |
104 for row in reader: |
100 for row in reader: |
105 type = int(row[0]) |
101 type = int(row[0]) |
106 style = row[1] |
102 style = row[1] |
107 count = int(row[2]) |
103 |
108 if count == 0 or filter_html.Records.SUBDIRS[type] == style: |
104 if style == 'time': |
|
105 count = float(row[2]) |
|
106 else: |
|
107 count = int(row[2]) |
|
108 |
|
109 if count == 0 or filter_html.Records.CLASSES[type] == style: |
109 grandtotal[type] += count |
110 grandtotal[type] += count |
110 columns.append((style,count)) |
111 columns.append((style,count)) |
111 else: |
112 else: |
112 sys.stderr.write("warning: %s appears to be corrupt or out of date\n" % t) |
113 sys.stderr.write("warning: %s appears to be corrupt or out of date\n" % t) |
113 except: |
114 except: |
117 try: |
118 try: |
118 linktext = os.path.dirname(t) |
119 linktext = os.path.dirname(t) |
119 linkname = os.path.relpath(os.path.join(linktext, "index.html"), indexdir) |
120 linkname = os.path.relpath(os.path.join(linktext, "index.html"), indexdir) |
120 index.write('<tr><td class="name"><a href="%s">%s</a></td>' % (linkname, linktext)) |
121 index.write('<tr><td class="name"><a href="%s">%s</a></td>' % (linkname, linktext)) |
121 for (style, count) in columns: |
122 for (style, count) in columns: |
122 index.write('<td class="%s">%d</td>' % (style, count)) |
123 if style == 'time': |
|
124 n = time.strftime("%H:%M:%S", time.gmtime(count + 0.5)) |
|
125 else: |
|
126 n = str(count) |
|
127 index.write('<td class="%s">%s</td>' % (style, n)) |
123 index.write("</tr>") |
128 index.write("</tr>") |
124 except: |
129 except: |
125 sys.stderr.write("error: cannot write index file %s\n" % indexfile) |
130 sys.stderr.write("error: cannot write index file %s\n" % indexfile) |
126 sys.exit(1) |
131 sys.exit(1) |
127 |
132 |
128 # finish off |
133 # finish off |
129 try: |
134 try: |
130 index.write('<tr><td> </td></tr><tr><td class="name">total</td>') |
135 index.write('<tr><td> </td></tr><tr><td class="name">total</td>') |
131 for i, count in enumerate(grandtotal): |
136 for i, count in enumerate(grandtotal): |
|
137 style = filter_html.Records.CLASSES[i] |
|
138 if style == 'time': |
|
139 n = time.strftime("%H:%M:%S", time.gmtime(count + 0.5)) |
|
140 else: |
|
141 n = str(count) |
|
142 |
132 if count == 0: |
143 if count == 0: |
133 index.write('<td class="zero">0</td>') |
144 index.write('<td class="zero">0</td>') |
134 else: |
145 else: |
135 index.write('<td class="%s">%d</td>' % (filter_html.Records.SUBDIRS[i], count)) |
146 index.write('<td class="%s">%s</td>' % (style, n)) |
136 index.write("</tr></table>") |
147 index.write("</tr></table>") |
137 index.write("</body></html>\n") |
148 index.write("</body></html>\n") |
138 index.close() |
149 index.close() |
139 |
150 |
140 except: |
151 except: |