fix: the gap CLI sets bundled files apart

cross_reference printed 20 runtime components bundled with their emulator as [MISSING] and counted them among the files to source. The collection leaves them out by design, as verify and the gaps page already say. They are now listed as [BUNDLED] and counted on their own line.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 01:18:09 +02:00
1 parent c6db200beb
commit 7aa9b3fcaa
2 files changed
+36

No files matched your search

+13
View File
@@ -739,6 +739,9 @@ def print_report(
total_gaps = 0
totals: dict[str, int] = {"bios": 0, "data": 0, "large_file": 0, "missing": 0}
# A runtime component bundled with its emulator is left out of the
# collection by design, as verify and the gaps page say: not a file to find.
bundled = 0
for emu_name, data in sorted(report.items()):
gaps = data["gaps"]
@@ -764,6 +767,8 @@ def print_report(
for g in data["gap_details"]:
req = "*" if g["required"] else " "
src = g.get("source", "missing").upper()
if g.get("bundled") and g.get("source") == "missing":
src = "BUNDLED"
# One line per file: a note spanning lines fell to column 0
# between entries and read as an emulator heading.
note = f": {' '.join(str(g['note']).split())}" if g["note"] else ""
@@ -777,6 +782,12 @@ def print_report(
total_gaps += gaps
for key in totals:
totals[key] += data.get(f"gap_{key}", 0)
emulator_bundled = sum(
1 for g in data["gap_details"]
if g.get("bundled") and g.get("source") == "missing"
)
bundled += emulator_bundled
totals["missing"] -= emulator_bundled
print(f"\n{'=' * 60}")
print(f"Total: {total_gaps} undeclared files across {scope}")
@@ -784,6 +795,8 @@ def print_report(
print(f" {available} available (bios: {totals['bios']}, data: {totals['data']}, "
f"large_file: {totals['large_file']})")
print(f" {totals['missing']} missing (need to be sourced)")
if bundled:
print(f" {bundled} bundled with their emulator, not collected")
def main() -> None:
+23
View File
@@ -5304,5 +5304,28 @@ class TheTreeKeepsStandaloneEntries(unittest.TestCase):
self.assertGreater(int(undeclared.group(1)), 0)
class TheCliSetsBundledFilesApart(unittest.TestCase):
"""cross_reference counted daedalusx64's n64.psh and touchHLE's runtime
libraries as missing, to be sourced, though the project leaves them out
by design and verify and the gaps page already say so."""
def test_a_bundled_gap_is_not_missing(self):
from scripts.cross_reference import print_report
gap = {"name": "n64.psh", "required": True, "bundled": True, "note": "",
"source": "missing"}
report = {"emu": {
"emulator": "Emu", "systems": [], "total_files": 1, "platform_covered": 0,
"gaps": 1, "gap_missing": 1, "gap_details": [gap],
}}
out = io.StringIO()
with contextlib.redirect_stdout(out):
print_report(report)
text = out.getvalue()
self.assertIn("0 missing (need to be sourced)", text)
self.assertIn("1 bundled with their emulator", text)
self.assertIn("n64.psh [BUNDLED]", text)
if __name__ == "__main__":
unittest.main()