def gen_dashboard_html(hjson_path, outfile): with hjson_path: prjfile = open(str(hjson_path)) try: obj = hjson.load(prjfile) except ValueError: raise SystemExit(sys.exc_info()[1]) if dashboard_validate.validate(obj) == 0: log.info("Generated dashboard object for " + str(hjson_path)) else: log.fail("hjson file import failed\n") life_stage = obj['life_stage'] life_stage_mapping = convert_stage(obj['life_stage']) # yapf: disable genout(outfile, " <tr>\n") genout(outfile, " <td class=\"fixleft\">" + html.escape(obj['name']) + "</td>\n") genout(outfile, " <td class=\"fixleft\">" + html.escape(obj['version']) + "</td>\n") genout(outfile, " <td class=\"fixleft\">" + html.escape(life_stage) + " - " + html.escape(life_stage_mapping) + "</td>\n") if life_stage != 'L0' and 'design_stage' in obj: design_stage_mapping = convert_stage(obj['design_stage']) genout(outfile, " <td class=\"fixleft\">" + html.escape(obj['design_stage']) + " - " + html.escape(design_stage_mapping) + "</td>\n") else: genout(outfile, " <td> </td>\n") if life_stage != 'L0' and 'verification_stage' in obj: verification_stage_mapping = convert_stage(obj['verification_stage']) genout(outfile, " <td class=\"fixleft\">" + html.escape(obj['verification_stage']) + " - " + html.escape(verification_stage_mapping) + "</td>\n") else: genout(outfile, " <td> </td>\n") if 'notes' in obj: genout(outfile, " <td>" + html.escape(obj['notes']) + "</td>\n") else: genout(outfile, " <td> </td>\n") genout(outfile, " </tr>\n") # yapf: enable return
def gen_specboard_html(hjson_path, rel_hjson_path, outfile): with hjson_path: prjfile = open(str(hjson_path)) try: obj = hjson.load(prjfile) except ValueError: raise SystemExit(sys.exc_info()[1]) if dashboard_validate.validate(obj) == 0: log.info("Generated dashboard object for " + str(hjson_path)) else: log.fail("hjson file import failed") # create design spec and DV plan references, check for existence below design_spec_md = re.sub(r'/data/', '/doc/', re.sub(r'\.prj\.hjson', '.md', str(hjson_path))) dv_plan_md = re.sub( r'/data/', '/doc/', re.sub(r'\.prj\.hjson', '_dv_plan.md', str(hjson_path))) design_spec_html = re.sub( r'/data/', '/doc/', re.sub(r'\.prj\.hjson', '.html', str(rel_hjson_path))) dv_plan_html = re.sub( r'/data/', '/doc/', re.sub(r'\.prj\.hjson', '_dv_plan.html', str(rel_hjson_path))) # yapf: disable genout(outfile, " <tr>\n") genout(outfile, " <td class=\"fixleft\">" + html.escape(obj['name']) + "</td>\n") if os.path.exists(design_spec_md): genout(outfile, " <td class=\"fixleft\"><a href=\"" + html.escape(design_spec_html) + "\">" + "design spec</a>\n") else: genout(outfile, " <td> </td>\n") if os.path.exists(dv_plan_md): genout(outfile, " <td class=\"fixleft\"><a href=\"" + html.escape(dv_plan_html) + "\">" + "DV plan</a>\n") else: genout(outfile, " <td> </td>\n") genout(outfile, " </tr>\n") # yapf: enable return
def gen_dashboard_html(hjson_path, outfile): with hjson_path: prjfile = open(str(hjson_path)) try: obj = hjson.load(prjfile) except ValueError: raise SystemExit(sys.exc_info()[1]) if dashboard_validate.validate(obj) == 0: log.info("Generated dashboard object for " + str(hjson_path)) else: log.fail("hjson file import failed\n") # If `revisions` field doesn't exist, the tool assumes the Hjson # as the previous project format, which has only one version entry. if not "revisions" in obj: print_version1_format(obj, outfile) else: print_multiversion_format(obj, outfile) return