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

+3 -3
View File
@@ -13,7 +13,7 @@ from __future__ import annotations
from sitegen import markup
from model.guides import Guide, TERMINALS, TRUST_ITEMS, install_command
from model.guides import Guide, terminals, trust_items, install_command
# The title over each command block, by the shell it is written for.
@@ -42,7 +42,7 @@ def terminal_tabs(
after its text and after its command (sitegen.steps.install_box)."""
items = []
for key in tabs:
label, shared, shell = TERMINALS[key]
label, shared, shell = terminals()[key]
if len(tabs) == 1 and key in PLACES:
label = "" # one place, which the text around already names
text = (how or {}).get(key) or shared
@@ -70,7 +70,7 @@ def platform_args(name: str, guide: Guide) -> dict[str, str]:
def trust_box(prefix: str, indent: str = "") -> list[str]:
"""Is it safe, under every command on a guide page: the trust items."""
return markup.details("note", "Is it safe?", [
*(f"- {item}" for item in TRUST_ITEMS),
*(f"- {item}" for item in trust_items()),
"",
f"[Read the script first]({prefix}wiki/faq.md#is-piping-the-installer-into-a-shell-safe)",
], indent)