fix: read the platform guides on first use

model.guides read and checked _registry.yml and _guides.yml at import,
from the repository: a pack build died on a registry entry without a guide
before parsing its options, and a site run on another platforms folder
took the repository's guides. The guides now load on first use, keyed on
siteinputs.current().platforms, behind accessor functions.
This commit is contained in:
Abdessamad Derraz committed 2026-11-23 21:02:46 +01:00
1 parent 9f987adb8c
commit e8b3cef5d5
31 files changed
+290 -204

No files matched your search

+6 -6
View File
@@ -928,9 +928,9 @@ class RetroArchWindowsSystemFolder(unittest.TestCase):
source = inspect.getsource(install)
self.assertIn('ra_dir or exe_dir / "system"', source)
self.assertTrue(str(install._os_default_dests("windows")["retroarch"]).replace("\\", "/").endswith("/system"))
from model.guides import GUIDES
from model.guides import platform_guides
guide = GUIDES["retroarch"]
guide = platform_guides()["retroarch"]
section = "\n".join([*(path for _label, path in guide.folders), *guide.notes])
self.assertNotIn("%APPDATA%\\RetroArch\\system", section)
self.assertIn("`system\\` next to `retroarch.exe`", section)
@@ -941,11 +941,11 @@ class RetroArchWindowsSystemFolder(unittest.TestCase):
(platform_darwin.m), Application Support only for a portable or
Steam build, and install.py looks there in that order."""
import install
from model.guides import GUIDES
from model.guides import platform_guides
source = inspect.getsource(install._macos_retroarch_base)
self.assertIn('Path.home() / "Documents" / "RetroArch"', source)
folders = dict(GUIDES["retroarch"].folders)
folders = dict(platform_guides()["retroarch"].folders)
self.assertEqual(folders["macOS"], "`~/Documents/RetroArch/system/`")
@@ -1645,9 +1645,9 @@ def unserved_one_liners(page: str, text: str) -> list[str]:
address of the repository stays as the fallback of the One line
section, and must name a bootstrap the repository holds."""
from sitegen import bootstrap as sitebootstrap
from model.guides import INSTALL_BASE
from model.guides import install_base
served = {f"{INSTALL_BASE}/{name}" for name in sitebootstrap.SOURCES}
served = {f"{install_base()}/{name}" for name in sitebootstrap.SOURCES}
fallback = _section(text, "One line") if page == "installer.md" else ""
stale = []
for line in text.splitlines():