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

+5 -3
View File
@@ -8,7 +8,7 @@ from typing import TypeVar
from core.text import series
from model.collection import profiles_on_disk
from model.composition import GAME_DATA_TOPS
from model.guides import INSTALL_PS1, INSTALL_SH
from model.guides import install_ps1, install_sh
from model.profiles import entry_system_ids
from packs.consumers import FileConsumers
from sitegen.cards import emulator_display, romset_releases, system_file_card
@@ -41,14 +41,16 @@ SYSTEM_SUMMARY_HTML = 500_000
# bootstrap, 66 characters (67 for PowerShell). A box is weighed with its
# address at that length, so the shorter site address moves no console off
# or onto a summary and no card changes address.
FITTED_ADDRESS_CHARS = {INSTALL_PS1: 67, INSTALL_SH: 66}
FITTED_ADDRESS_CHARS = {"ps1": 67, "sh": 66}
def install_box_weight(lines: list[str]) -> int:
fitted_chars = {install_ps1(): FITTED_ADDRESS_CHARS["ps1"],
install_sh(): FITTED_ADDRESS_CHARS["sh"]}
weight = 0
for line in lines:
weight += len(line) + 1
for address, fitted in FITTED_ADDRESS_CHARS.items():
for address, fitted in fitted_chars.items():
found = line.count(address)
line = line.replace(address, "")
weight += found * (fitted - len(address))