Loading tools/compare_fileslist.py +27 −18 Original line number Diff line number Diff line Loading @@ -15,8 +15,17 @@ # limitations under the License. # from __future__ import print_function import cgi, os, string, sys def iteritems(obj): if hasattr(obj, 'iteritems'): return obj.iteritems() return obj.items() def IsDifferent(row): val = None for v in row: Loading @@ -37,23 +46,23 @@ def main(argv): lines = f.readlines() f.close() lines = map(string.split, lines) lines = map(lambda (x,y): (y,int(x)), lines) lines = [(x_y[1],int(x_y[0])) for x_y in lines] for fn,sz in lines: if not data.has_key(fn): if fn not in data: data[fn] = {} data[fn][index] = sz index = index + 1 rows = [] for fn,sizes in data.iteritems(): for fn,sizes in iteritems(data): row = [fn] for i in range(0,index): if sizes.has_key(i): if i in sizes: row.append(sizes[i]) else: row.append(None) rows.append(row) rows = sorted(rows, key=lambda x: x[0]) print """<html> print("""<html> <head> <style type="text/css"> .fn, .sz, .z, .d { Loading @@ -78,27 +87,27 @@ def main(argv): </style> </head> <body> """ print "<table>" print "<tr>" """) print("<table>") print("<tr>") for input in inputs: combo = input.split(os.path.sep)[1] print " <td class='fn'>%s</td>" % cgi.escape(combo) print "</tr>" print(" <td class='fn'>%s</td>" % cgi.escape(combo)) print("</tr>") for row in rows: print "<tr>" print("<tr>") for sz in row[1:]: if not sz: print " <td class='z'> </td>" print(" <td class='z'> </td>") elif IsDifferent(row[1:]): print " <td class='d'>%d</td>" % sz print(" <td class='d'>%d</td>" % sz) else: print " <td class='sz'>%d</td>" % sz print " <td class='fn'>%s</td>" % cgi.escape(row[0]) print "</tr>" print "</table>" print "</body></html>" print(" <td class='sz'>%d</td>" % sz) print(" <td class='fn'>%s</td>" % cgi.escape(row[0])) print("</tr>") print("</table>") print("</body></html>") if __name__ == '__main__': main(sys.argv) Loading Loading
tools/compare_fileslist.py +27 −18 Original line number Diff line number Diff line Loading @@ -15,8 +15,17 @@ # limitations under the License. # from __future__ import print_function import cgi, os, string, sys def iteritems(obj): if hasattr(obj, 'iteritems'): return obj.iteritems() return obj.items() def IsDifferent(row): val = None for v in row: Loading @@ -37,23 +46,23 @@ def main(argv): lines = f.readlines() f.close() lines = map(string.split, lines) lines = map(lambda (x,y): (y,int(x)), lines) lines = [(x_y[1],int(x_y[0])) for x_y in lines] for fn,sz in lines: if not data.has_key(fn): if fn not in data: data[fn] = {} data[fn][index] = sz index = index + 1 rows = [] for fn,sizes in data.iteritems(): for fn,sizes in iteritems(data): row = [fn] for i in range(0,index): if sizes.has_key(i): if i in sizes: row.append(sizes[i]) else: row.append(None) rows.append(row) rows = sorted(rows, key=lambda x: x[0]) print """<html> print("""<html> <head> <style type="text/css"> .fn, .sz, .z, .d { Loading @@ -78,27 +87,27 @@ def main(argv): </style> </head> <body> """ print "<table>" print "<tr>" """) print("<table>") print("<tr>") for input in inputs: combo = input.split(os.path.sep)[1] print " <td class='fn'>%s</td>" % cgi.escape(combo) print "</tr>" print(" <td class='fn'>%s</td>" % cgi.escape(combo)) print("</tr>") for row in rows: print "<tr>" print("<tr>") for sz in row[1:]: if not sz: print " <td class='z'> </td>" print(" <td class='z'> </td>") elif IsDifferent(row[1:]): print " <td class='d'>%d</td>" % sz print(" <td class='d'>%d</td>" % sz) else: print " <td class='sz'>%d</td>" % sz print " <td class='fn'>%s</td>" % cgi.escape(row[0]) print "</tr>" print "</table>" print "</body></html>" print(" <td class='sz'>%d</td>" % sz) print(" <td class='fn'>%s</td>" % cgi.escape(row[0])) print("</tr>") print("</table>") print("</body></html>") if __name__ == '__main__': main(sys.argv) Loading