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

+9 -9
View File
@@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, TypedDict
from core.options import reject_unknown
from model.region import label as region_label
from model.guides import INSTALL_PS1, INSTALL_SH, pack_manual
from model.guides import install_ps1, install_sh, pack_manual
if TYPE_CHECKING:
from typing_extensions import Unpack
@@ -32,9 +32,9 @@ def _from_pack(platform_name: str, posix: bool, windows: bool,
lines = [" Already have this ZIP? Add --from-pack and its path: the files",
" come from it, not from the network. For a pack in parts, name one part.", ""]
if posix:
lines.append(f" curl -fsSL {INSTALL_SH} | sh -s -- {args} /path/to/pack.zip{dest[0]}")
lines.append(f" curl -fsSL {install_sh()} | sh -s -- {args} /path/to/pack.zip{dest[0]}")
if windows:
lines.append(f" &([scriptblock]::Create((irm {INSTALL_PS1}))) {args} C:\\path\\to\\pack.zip"
lines.append(f" &([scriptblock]::Create((irm {install_ps1()}))) {args} C:\\path\\to\\pack.zip"
f"{dest[1]}")
return [*lines, ""]
@@ -50,9 +50,9 @@ def _card_section(platform_name: str, display: str) -> str:
" ---------------------------------\n"
" With the SD card mounted on a computer, name its root with --dest.\n"
" Linux and macOS: run this in a terminal:\n\n"
f" curl -fsSL {INSTALL_SH} | sh -s -- --platform {platform_name} --dest /path/to/card\n\n"
f" curl -fsSL {install_sh()} | sh -s -- --platform {platform_name} --dest /path/to/card\n\n"
" Windows: run this in PowerShell (E: being the card):\n\n"
f" &([scriptblock]::Create((irm {INSTALL_PS1}))) --platform {platform_name} --dest E:\\\n\n"
f" &([scriptblock]::Create((irm {install_ps1()}))) --platform {platform_name} --dest E:\\\n\n"
f" The installer writes each file where {display} hands it to the core\n"
" and checks every file.\n\n"
+ "\n".join(_from_pack(platform_name, True, True, (" --dest /path/to/card", " --dest E:\\")))
@@ -100,9 +100,9 @@ def _automatic_section(
else:
labels = {"linux": "Linux", "darwin": "macOS"}
where = f"{' and '.join(labels[name] for name in posix)}: run this in a terminal:"
lines += [f" {where}", "", f" curl -fsSL {INSTALL_SH} | sh", ""]
lines += [f" {where}", "", f" curl -fsSL {install_sh()} | sh", ""]
if "windows" in systems:
lines += [" Windows: run this in PowerShell:", "", f" irm {INSTALL_PS1} | iex", ""]
lines += [" Windows: run this in PowerShell:", "", f" irm {install_ps1()} | iex", ""]
lines += [
f" The installer finds the {display} BIOS folder on this machine and",
" installs there, checking every file. --dest names another folder.",
@@ -119,9 +119,9 @@ def _automatic_section(
"",
]
if posix:
lines.append(f" curl -fsSL {INSTALL_SH} | sh -s -- --standalone-copies")
lines.append(f" curl -fsSL {install_sh()} | sh -s -- --standalone-copies")
if "windows" in systems:
lines.append(f" &([scriptblock]::Create((irm {INSTALL_PS1}))) --standalone-copies")
lines.append(f" &([scriptblock]::Create((irm {install_ps1()}))) --standalone-copies")
lines.append("")
return "\n".join(lines) + "\n"