mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: link the check commands from the pack pages
The get pages told a reader on another setup version to run `--check` after copying, with no command and no link, to someone holding a ZIP and no installer. The line now links the setup page's How to check section.
This commit is contained in:
1 parent
32cc1ce4fa
commit
8584847bc9
2 files changed
+24
-9
No files matched your search
@@ -679,9 +679,13 @@ def release_line(platform_name: str, record: dict) -> list[str]:
|
||||
return lines
|
||||
|
||||
|
||||
# What a reader on another version of the setup does with the pack. Our data
|
||||
# says which list the pack was made from, not what an older list lacks.
|
||||
OTHER_VERSION = "Other version? Run `--check` after copying."
|
||||
def other_version(platform_name: str, prefix: str = "../") -> str:
|
||||
"""What a reader on another version of the setup does with the pack.
|
||||
Our data says which list the pack was made from, not what an older list
|
||||
lacks. A bare `--check` was no command to run for someone holding a ZIP:
|
||||
the line links the setup page's commands that check."""
|
||||
target = f"{prefix}platforms/{platform_name}.md#how-to-check"
|
||||
return f"Other version? [Check the files]({target}) after copying."
|
||||
|
||||
|
||||
def setup_version(platform_name: str, record: dict | None = None) -> str:
|
||||
@@ -700,13 +704,15 @@ def setup_version(platform_name: str, record: dict | None = None) -> str:
|
||||
return f"{config.get('platform', platform_name)} {version.removeprefix('v')}"
|
||||
|
||||
|
||||
def version_line(platform_name: str, record: dict, named: bool = False) -> str:
|
||||
def version_line(platform_name: str, record: dict, named: bool = False,
|
||||
prefix: str = "../") -> str:
|
||||
"""The version the pack fits, and what to do on another. *named* when
|
||||
the release line already named the pack's version."""
|
||||
made_from = setup_version(platform_name, record)
|
||||
other = other_version(platform_name, prefix)
|
||||
if named or not made_from:
|
||||
return OTHER_VERSION
|
||||
return f"Made for {made_from}. {OTHER_VERSION}"
|
||||
return other
|
||||
return f"Made for {made_from}. {other}"
|
||||
|
||||
|
||||
# Why a setup has no ZIP, answered once on the FAQ.
|
||||
@@ -793,7 +799,8 @@ def _pack_buttons(platform_name: str, label: str = "Pack", prefix: str = "../",
|
||||
)
|
||||
released = release_line(platform_name, record)
|
||||
return "\n\n".join([buttons, *released,
|
||||
version_line(platform_name, record, named=len(released) > 1)])
|
||||
version_line(platform_name, record, named=len(released) > 1,
|
||||
prefix=prefix)])
|
||||
|
||||
|
||||
def generate_get_page(platform_name: str) -> str:
|
||||
|
||||
@@ -443,14 +443,22 @@ class PackNamesItsVersion(unittest.TestCase):
|
||||
block = generate_site._pack_buttons("batocera")
|
||||
version = generate_site._pack_version(release_record.pack_name_for("batocera", record))
|
||||
self.assertIn(f"Made for Batocera {version}. "
|
||||
+ generate_site.OTHER_VERSION, block)
|
||||
+ generate_site.other_version("batocera"), block)
|
||||
|
||||
def test_a_version_gap_is_said_once(self):
|
||||
record = {"tag": "v2026.10.10", "packs": {"RetroBat_1.0_BIOS_Pack.zip": {
|
||||
"assets": ["RetroBat_1.0_BIOS_Pack.zip"], "platforms": ["retrobat"]}}}
|
||||
released = generate_site.release_line("retrobat", record)
|
||||
line = generate_site.version_line("retrobat", record, named=len(released) > 1)
|
||||
self.assertEqual(line, generate_site.OTHER_VERSION)
|
||||
self.assertEqual(line, generate_site.other_version("retrobat"))
|
||||
|
||||
def test_another_version_is_sent_to_the_check_commands(self):
|
||||
"""A ZIP reader read "Run `--check` after copying." with no command."""
|
||||
line = generate_site.other_version("emudeck")
|
||||
self.assertNotIn("Run `--check`", line)
|
||||
self.assertIn("](../platforms/emudeck.md#how-to-check)", line)
|
||||
page = _page("platforms/emudeck.md")
|
||||
self.assertIn("{ #how-to-check }", page)
|
||||
|
||||
def test_the_v_prefix_is_dropped(self):
|
||||
self.assertEqual(generate_site.setup_version("retroarch", {}),
|
||||
|
||||
Reference in new issue
Block a user