#!/usr/bin/env python3 import glob import os import re import sys import time sys.path.append(os.path.join(os.path.dirname(__file__), "..")) from . import html_output def write_addon_overview(folder, addon): out = open(os.path.join(folder, "index.html"), "w") def w(x): out.write(x + "\n") name = addon["name"] title = html_output.cleantext("Build Report for " + name) generation_note = "Last updated on " + time.ctime() + "." w(html_output.website_header(path="../", title=title, classes=["wmlunits-report"])) w('
Warnings or errors were found: log
') w('') w('Addon | Output Files | Error Log |
---|---|---|
') w('' + html_output.cleantext(name, quote=False) + '') w(' | ') w(str(n)) w(' | ')
if os.path.exists(error_log):
text = open(error_log).read()
error_kind = "warnings"
if " ' for s in source: line = line.replace(s, "WML") line = line.replace("included from WML:1", "") rows = line.replace("included from", "\n included from").splitlines() out = "" for row in rows: row = row.strip() out += row + ' ' return out htmlerr = open(error_html, "w") htmlerr.write('') lines_count = 0 for line in text.splitlines(): line = line.strip() if line in [" ' % line[1:-1].replace(" ", "-").lower()) elif line in [" ') total_lines += lines_count total_error_logs += 1 w('%s (%d lines)' % (html_output.cleanurl(error_name), error_kind, lines_count)) w(' |
Total (for %d addons): | ' % count) w('' + str(total_n) + ' | ') w('' + str(total_error_logs) + ' (' + str(total_lines) + ' lines) | ') w('