Update dtk-template

This commit is contained in:
LagoLunatic
2025-05-22 15:33:51 -04:00
parent 936a47461d
commit a0884623c6
3 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ if args.no_asm:
# Tool versions
config.binutils_tag = "2.42-1"
config.compilers_tag = "20240706"
config.compilers_tag = "20250520"
config.dtk_tag = "v1.5.1"
config.objdiff_tag = "v3.0.0-beta.8"
config.sjiswrap_tag = "v1.2.1"
+13 -5
View File
@@ -4,7 +4,7 @@ from argparse import ArgumentParser
import os
import json
from pathlib import Path
from typing import Tuple
from typing import Optional, Tuple
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
@@ -25,7 +25,13 @@ FUNCTION_KEYS_TO_DIFF = [
Change = Tuple[str, str, float, float]
def get_changes(changes_file: str) -> list[Change]:
def format_float(value: float) -> str:
if value < 100.0 and value > 99.99:
value = 99.99
return "%6.2f" % value
def get_changes(changes_file: str) -> Tuple[list[Change], list[Change]]:
changes_file = os.path.relpath(changes_file, root_dir)
with open(changes_file, "r") as f:
changes_json = json.load(f)
@@ -33,7 +39,7 @@ def get_changes(changes_file: str) -> list[Change]:
regressions = []
progressions = []
def diff_key(object_name: str, object: dict, key: str):
def diff_key(object_name: Optional[str], object: dict, key: str):
from_value = object.get("from", {}).get(key, 0.0)
to_value = object.get("to", {}).get(key, 0.0)
key = key.removesuffix("_percent")
@@ -77,7 +83,7 @@ def generate_changes_plaintext(changes: list[Change]) -> str:
if len(name) > name_max_len:
name = name[: name_max_len - len("[...]")] + "[...]"
out_lines.append(
f"{name:>{name_max_len}} | {key:<{key_max_len}} | {from_value:6.2f}% -> {to_value:5.2f}%"
f"{name:>{name_max_len}} | {key:<{key_max_len}} | {format_float(from_value)}% -> {format_float(to_value)}%"
)
return "\n".join(out_lines)
@@ -106,7 +112,9 @@ def generate_changes_markdown(changes: list[Change], description: str) -> str:
name = name[: name_max_len - len("...")] + "..."
name = f"`{name}`" # Surround with backticks
key = key.replace("_", " ").capitalize()
out_lines.append(f"| {name} | {key} | {from_value:.2f}% | {to_value:.2f}% |")
out_lines.append(
f"| {name} | {key} | {format_float(from_value)}% | {format_float(to_value)}% |"
)
out_lines.append("</details>")
+1
View File
@@ -1439,6 +1439,7 @@ def generate_objdiff_config(
COMPILER_MAP = {
"GC/1.0": "mwcc_233_144",
"GC/1.1": "mwcc_233_159",
"GC/1.1p1": "mwcc_233_159p1",
"GC/1.2.5": "mwcc_233_163",
"GC/1.2.5e": "mwcc_233_163e",
"GC/1.2.5n": "mwcc_233_163n",