fix: keep setup pages in their budgets

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 13:05:31 +01:00
1 parent 586fbd7ef2
commit 2722f6f9ce
3 files changed
+24 -10

No files matched your search

+12 -7
View File
@@ -3860,7 +3860,8 @@ def _platform_data_links(name: str) -> str:
f"[JSON](../api/v1/platforms/{name}.json)",
]
if (_REPO_ROOT / "install" / f"{name}.json").is_file():
links.append(f"[install manifest]({REPO_URL}/blob/main/install/{name}.json)")
# The site's own copy, byte for byte (_publish_manifests).
links.append(f"[install manifest](../api/v1/manifests/{name}.json)")
# The installed BIOS folder for clrmamepro and RomVault.
links.append(f"[DAT](../downloads/dat/{name}.dat)")
return ", ".join(links)
@@ -4098,11 +4099,10 @@ def _share_tabs(name: str, share: str) -> tuple[dict[str, str], dict[str, str]]:
"linux": f"--platform {name} --dest /path/to/{volume}{tail}",
}
how = {
"macos": (f"In Finder, choose Go, then Connect to Server, and enter `{url}`. "
f"It opens as `/Volumes/{volume}`. Then open **Terminal**, in "
"Applications, then Utilities. Paste the line. Press Return."),
"linux": (f"Open `{url}` in your file manager. Open a terminal, paste the line "
f"and change `/path/to/{volume}` to the folder it opened. Press Enter."),
"macos": (f"In Finder, Go > Connect to Server: `{url}`. Then paste the line in "
"**Terminal**."),
"linux": (f"Open `{url}` in your file manager. Paste the line in a terminal, "
f"with the folder it opened for `/path/to/{volume}`."),
}
return args, how
@@ -4168,10 +4168,15 @@ def _setup_routes(name: str, display: str, page_link: bool = False) -> list[str]
computer = ["## From your computer { #from-your-computer }", ""]
if share:
args, how = _share_tabs(name, share)
# The setup page stays in its word budget: its Mac and Linux
# lines are on the get/ page, the one the command is shared from.
tabs = ("windows",) if page_link else ("windows", "macos", "linux")
computer += [
"Needs the device on your network. Run the command on the computer.",
"",
*terminal_tabs(("windows", "macos", "linux"), args, how=how),
*terminal_tabs(tabs, args, how=how),
*([f"[Mac or Linux](../{get_page_link(name)}#from-your-computer)", ""]
if page_link else []),
SAFE_LINK,
"",
]
+3 -1
View File
@@ -91,13 +91,15 @@ class NoZipNoUnzipText(unittest.TestCase):
args, how = generate_site._share_tabs("recalbox", "\\\\RECALBOX\\share\\bios")
self.assertEqual(args["macos"], "--platform recalbox --dest /Volumes/share/bios")
self.assertIn("`smb://recalbox/share`", how["macos"])
self.assertIn("`/Volumes/share`", how["macos"])
self.assertEqual(args["linux"], "--platform recalbox --dest /path/to/share/bios")
self.assertIn("`smb://recalbox/share`", how["linux"])
lines = generate_site._setup_routes("recalbox", "Recalbox")
routes = "\n".join(lines[:lines.index("## On the device { #install }")])
for label in ("Windows", "macOS", "Linux"):
self.assertIn(f'label="{label}"', routes)
# The setup page sends a Mac or Linux reader to those tabs.
lines = generate_site._setup_routes("recalbox", "Recalbox", page_link=True)
self.assertIn("[Mac or Linux](../get/recalbox.md#from-your-computer)", lines)
def test_the_network_route_needs_a_share_and_no_zip(self):
for name in SETUPS:
+9 -2
View File
@@ -59,8 +59,14 @@ class GetPagesGiveTheSetupsOwnRoutes(unittest.TestCase):
def test_every_command_on_a_get_page_is_on_its_setup_page(self):
for name in SETUPS:
get = set(COMMAND.findall(_page(f"get/{name}.md")))
setup = set(COMMAND.findall(_page(f"platforms/{name}.md")))
page = _page(f"platforms/{name}.md")
setup = set(COMMAND.findall(page))
with self.subTest(setup=name):
# The Mac and Linux lines of the network folder live on the
# get/ page alone, which the setup page links for them.
if f"(/retrobios/get/{name}/#from-your-computer)" in page:
get = {c for c in get if "--dest /Volumes/" not in c
and "--dest /path/to/" not in c}
self.assertTrue(get <= setup, sorted(get - setup))
if not _with_zip(name):
self.assertTrue(get, "a setup with no ZIP gets its command")
@@ -82,7 +88,8 @@ class GetPagesGiveTheSetupsOwnRoutes(unittest.TestCase):
allowed = {labels[key] for key in guide.run}
allowed |= {labels[key] for key in guide.card_run or ("windows", "macos", "linux")}
if generate_site._network_share(name, guide):
allowed.add(labels["windows"])
# The network folder is reached from any computer.
allowed |= {labels[key] for key in ("windows", "macos", "linux")}
with self.subTest(setup=name):
self.assertLessEqual(_tab_labels(_page(f"get/{name}.md")), allowed)
self.assertNotIn("Android (Termux", _page(f"get/{name}.md"))