fix: say when a RetroPie help is updated in part

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 14:56:11 +01:00
1 parent 144cd46df1
commit 6a5b384e02
2 files changed
+28 -11

No files matched your search

+20 -9
View File
@@ -336,6 +336,8 @@ class Exporter(BaseExporter):
systems_of.setdefault(str(name).lower(), set()).add(fe.native_system)
known = set(systems_of)
self._skipped: dict[str, list[str]] = {}
# Rewritten, with a file of a system no clause lists left out.
self._partial: list[str] = []
self._named: set[int] = set()
produced: dict[str, str] = {}
@@ -400,12 +402,11 @@ class Exporter(BaseExporter):
homes.setdefault(owners[0], []).append(fe)
else:
homeless = True
if homeless:
# No enumeration of that system to extend, and a sentence we
# would have to write ourselves is a documentation change,
# not a correction.
skip("whose help text lists no files of that system to add to", module_id)
# No enumeration of that system to extend, and a sentence we
# would have to write ourselves is a documentation change, not a
# correction. With nothing placed the package is left as is.
if not homes:
skip("whose help text lists no files of that system to add to", module_id)
continue
added = sum(len(self._in_search_order(fes)) for fes in homes.values())
@@ -428,6 +429,8 @@ class Exporter(BaseExporter):
f'rp_module_help="{new_help}"',
1,
)
if homeless:
self._partial.append(module_id)
return produced
@@ -454,12 +457,20 @@ class Exporter(BaseExporter):
) -> str:
"""Packages are the unit here, not file entries."""
skipped: dict[str, list[str]] = getattr(self, "_skipped", {})
def shown(modules: list[str]) -> str:
names = ", ".join(sorted(modules)[:4])
return names + (f" and {len(modules) - 4} more" if len(modules) > 4 else "")
parts = [f"{len(produced)} packages updated"]
partial = getattr(self, "_partial", [])
if partial:
parts.append(
f"Updated in part: {shown(partial)}, whose help text lists no files "
"of one of their systems to add to"
)
for reason, modules in sorted(skipped.items()):
shown = ", ".join(sorted(modules)[:4])
if len(modules) > 4:
shown += f" and {len(modules) - 4} more"
parts.append(f"Left as is: {shown}, {reason}")
parts.append(f"Left as is: {shown(modules)}, {reason}")
return ". ".join(parts)
def validate(
+8 -2
View File
@@ -801,14 +801,20 @@ class SearchOrder(unittest.TestCase):
longest = ('rp_module_id="xm7"\nrp_module_help="Copy bios files '
+ ", ".join(f"n{i}.rom" for i in range(12)) + ' and n12.rom to $biosdir"\n')
exporter = discover_exporters()["retropie"]()
produced = exporter.render(
written = exporter.render(
systems, None,
{"scriptmodules/libretrocores/lr-flycast.sh": script,
"scriptmodules/emulators/xm7.sh": longest},
)["scriptmodules/libretrocores/lr-flycast.sh"]
)
produced = written["scriptmodules/libretrocores/lr-flycast.sh"]
self.assertIn("Dreamcast BIOS file dc_boot.bin to", produced)
self.assertIn("BIOS files naomi.zip, awbios.zip and naomi2.zip to", produced)
self.assertNotIn("other.zip", produced)
# Rewritten for naomi2.zip, other.zip left out: the summary said
# "Left as is" of a package in the diff.
outcome = exporter.outcome(systems, written)
self.assertIn("Updated in part: lr-flycast,", outcome)
self.assertNotIn("Left as is: lr-flycast", outcome)
def test_cores_that_disagree_keep_the_best_rank(self):
"""Nothing is dropped on the rank here, so the best one wins.