refactor: site modules into the sitegen package

This commit is contained in:
Abdessamad Derraz committed 2026-11-18 19:31:27 +01:00
1 parent 29f5c48a2c
commit 206dae3163
57 files changed
+98 -97

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ import subprocess
import tempfile
from pathlib import Path
from sitebootstrap import PIN
from sitegen.bootstrap import PIN
from model.guides import SH_NAME
ROOT = Path(__file__).resolve().parent.parent
+1 -1
View File
@@ -199,7 +199,7 @@ def fetch_logos() -> None:
def fetch_icons() -> None:
from model.database import load_database
from model.collection import _group_by_manufacturer
from siterender import SYSTEM_ICON_BASE, _icon_name
from sitegen.render import SYSTEM_ICON_BASE, _icon_name
db = load_database(str(ROOT / "database.json"))
names = sorted({
+1 -1
View File
@@ -47,7 +47,7 @@ import zipfile
from pathlib import Path, PurePosixPath
from typing import TYPE_CHECKING, Any, Callable
import sitehandheld
from sitegen import handheld as sitehandheld
from core.artifacts import write_text_atomic
if TYPE_CHECKING:
+28 -28
View File
@@ -72,7 +72,7 @@ from resolve.localfile import resolution_is_hash_exact, resolve_local_file
from resolve.cores import resolve_platform_cores
from resolve.layout import runs_standalone
from model.collection import SECTION_LABELS
from siterender import WIKI_SRC_DIR
from sitegen.render import WIKI_SRC_DIR
from core.artifacts import ArtifactLockBusy, artifact_lock
from core.artifacts import json_text as _json_text
from packs.crossref import FileConsumers, entry_target, held_copy
@@ -90,15 +90,15 @@ from generate_readme import (
release_totals,
)
from provenance_report import build_report, distinct_missing, profile_needs
import sitemarkup as markup
import siteentries
from sitegen import markup
from sitegen import entries as siteentries
from model import siteinputs
from model import retired as model_retired
import siteagents
from sitegen import agents as siteagents
import sitediagrams
import sitestarlight
import sitesteps
from siteexports import generate_exports_page, load_export_reports
from sitegen import starlight as sitestarlight
from sitegen import steps as sitesteps
from sitegen.exports import generate_exports_page, load_export_reports
from model.guides import (
ALSO_RUNS,
DEVICE_GROUPS,
@@ -118,16 +118,16 @@ from model.guides import (
install_command,
setup_count,
)
from siteguides import fence, platform_args, terminal_tabs, trust_box
from sitegen.guides import fence, platform_args, terminal_tabs, trust_box
import archive_build
import release_record
import sitebootstrap
import sitehandheld
import sitemeasurements
import sitewanted
from sitegen import bootstrap as sitebootstrap
from sitegen import handheld as sitehandheld
from sitegen import measurements as sitemeasurements
from sitegen import wanted as sitewanted
from resolve.review import load_platform_hashes, load_profile_hashes
from sitediagrams import local_images, prepare_page, unresolved_images
from sitewrite import (
from sitegen.write import (
_record,
_undecorated,
write_if_changed,
@@ -144,7 +144,7 @@ from sitesources import (
_source_ref_markdown,
version_basis_url,
)
from siterender import (
from sitegen.render import (
_count,
_field_text,
_render_yaml_value,
@@ -1983,7 +1983,7 @@ def system_index_items(db: dict, coverages: dict, profiles: dict) -> list[dict]:
takes the card of its first file, else the page of the emulator naming
it: 28 such ids sent their hashes to no page.
"""
from siterender import card_page, system_ids, system_section
from sitegen.render import card_page, system_ids, system_section
sha1_by_path = _sha1_by_path(db)
files = db.get("files") or {}
@@ -3675,7 +3675,7 @@ def _system_heading_link(sys_id: str, prefix: str = "") -> str:
def _system_named_link(sys_id: str, prefix: str = "") -> str:
"""A system's name, linked to the section system_section gives."""
from siterender import system_section
from sitegen.render import system_section
name = _escape_tags(system_name(sys_id))
section = system_section(sys_id)
@@ -5152,7 +5152,7 @@ def _console_system_names(profiles: dict, coverages: dict) -> dict[tuple[str, st
it is filed under. A folder no id owns, or that two names own, is left out.
"""
from model.systemnames import _own_section
from siterender import system_ids
from sitegen.render import system_ids
found: dict[tuple[str, str], set[str]] = {}
for sys_id in system_ids(profiles, [c["config"] for c in coverages.values()]):
@@ -6649,7 +6649,7 @@ def system_install_choices(coverages: dict) -> dict[str, dict[str, list[tuple[st
platform's install manifest records is offered: --system refuses any
other name.
"""
from siterender import _page_by_norm
from sitegen.render import _page_by_norm
choices: dict[str, dict[str, list[tuple[str, str]]]] = {}
for name, cov in sorted(coverages.items()):
@@ -6857,7 +6857,7 @@ _SECTION_ENTRIES: dict[int, tuple[object, dict[tuple[str, str], list]]] = {}
def _entries_by_section(consumers: FileConsumers) -> dict[tuple[str, str], list]:
"""Each console section with the (sha1, emulator, entry, system) whose
system leads to it, read once per build."""
from siterender import system_section
from sitegen.render import system_section
cached = _SECTION_ENTRIES.get(id(consumers))
if cached is not None and cached[0] is consumers:
@@ -7017,7 +7017,7 @@ def _section_reads(
"""The reads of each file the section names, by sha1, and the files the
start line may name: the section's primaries, then the Arcade files
its systems require."""
from siterender import system_section
from sitegen.render import system_section
held = {str(f.get("sha1", "")) for f in files}
primaries = [f for f in files if "/.variants/" not in f["path"]]
@@ -7672,7 +7672,7 @@ class _BoardSort:
def arcade_folders(self, arcade: dict[str, list], by_name: dict[str, str]) -> None:
"""The folders of bios/Arcade/, each file to its board or machine."""
from siterender import arcade_board, archive_machine
from sitegen.render import arcade_board, archive_machine
from model.collection import record_card_move
for console in sorted(arcade):
@@ -7693,7 +7693,7 @@ class _BoardSort:
"""A board's set filed under a machine's folder is on the board's page
too, whatever the folder: naomi.zip under the Dreamcast was the copy
five setups list, and the NAOMI page did not name it."""
from siterender import arcade_board, archive_machine
from sitegen.render import arcade_board, archive_machine
from model.collection import record_card_move
for mfr, consoles in manufacturers.items():
@@ -7730,7 +7730,7 @@ def _installs_by_board(
installs: dict[str, dict[str, list[tuple[str, str]]]],
) -> dict[str, dict[str, list[tuple[str, str]]]]:
"""A system's install commands, moved to its board's section."""
from siterender import system_section
from sitegen.render import system_section
moved: dict[str, dict[str, list[tuple[str, str]]]] = {}
for slug, consoles in installs.items():
@@ -7761,7 +7761,7 @@ def arcade_board_sections(
folders. Each board is recorded (siterender.record_board_section) before
any page links one, and a system's install commands follow its link to
the board's section. Call after reset_console_pages()."""
from siterender import arcade_boards, record_board_section
from sitegen.render import arcade_boards, record_board_section
_BOARD_CONSOLES.clear()
_BOARDS_FROM.clear()
@@ -7786,7 +7786,7 @@ def arcade_board_sections(
def _boards_line(manufacturer: str, console: str) -> list[str]:
"""The line of a section whose board sets went to the boards' pages:
the Dreamcast folder holds NAOMI's and Atomiswave's."""
from siterender import arcade_boards
from sitegen.render import arcade_boards
boards = _BOARDS_FROM.get((manufacturer, console))
if not boards:
@@ -8065,7 +8065,7 @@ class _MakerPages:
def moved_section(self, console: str, pages: dict[str, tuple[str, dict[str, list]]]) -> list[str]:
"""A console moved to pages of its own: the lines the summary keeps
under its heading. Its pages go into ``pages``."""
from siterender import board_slug
from sitegen.render import board_slug
manufacturer = self.manufacturer
label = _section_label(manufacturer, console)
@@ -8225,7 +8225,7 @@ def _named_system_link(sys_id: str, prefix: str = "") -> str:
The emulator pages printed the id ("sony-playstation") where every
other page says "Sony PlayStation". The id stays in the address only.
"""
from siterender import system_section
from sitegen.render import system_section
name = system_name(sys_id).replace("[", r"\[").replace("]", r"\]")
section = system_section(sys_id)
@@ -13194,7 +13194,7 @@ def _write_home_pages(run: _SiteRun) -> dict:
def _write_system_pages(run: _SiteRun) -> None:
"""The system pages, each manufacturer's, and their API items."""
from siterender import link_coverage, system_ids
from sitegen.render import link_coverage, system_ids
docs, public, db = run.docs, run.public, run.db
manufacturers = run.manufacturers
+1 -1
View File
@@ -27,7 +27,7 @@ import urllib.request
from pathlib import Path
sys.path.insert(0, os.path.dirname(__file__))
from siteagents import INDEXNOW_FILE, INDEXNOW_KEY, SITE
from sitegen.agents import INDEXNOW_FILE, INDEXNOW_KEY, SITE
HOST = "abdess.github.io"
# What one IndexNow request accepts.
+1 -1
View File
@@ -42,7 +42,7 @@ from xml.sax.saxutils import escape
sys.path.insert(0, str(Path(__file__).resolve().parent))
from model import siteinputs
import sitemarkup as markup
from sitegen import markup
from core.paths import REPO_ROOT
ROOT = REPO_ROOT
+1
View File
@@ -0,0 +1 @@
"""The documentation site: pages, navigation, data files and the README, from the project data."""
File renamed without changes.
File renamed without changes.
@@ -16,7 +16,7 @@ from __future__ import annotations
import html
from dataclasses import dataclass, field
import sitemarkup as markup
from sitegen import markup
# rehype-stack-tables.mjs RECORD_ROWS: from this many rows a table has a
# filter box, and its stacked labels are written by site.ts, not the build.
@@ -11,7 +11,7 @@ from __future__ import annotations
import json
from pathlib import Path
import sitemarkup as markup
from sitegen import markup
EXPORTS_DIR = "exports"
REPO_BLOB = "https://github.com/Abdess/retrobios/blob/main"
@@ -12,7 +12,7 @@ parts the pages share. The registry keeps the folder the pack unzips into
from __future__ import annotations
import sitemarkup as markup
from sitegen import markup
from model.guides import Guide, TERMINALS, TRUST_ITEMS, install_command
@@ -21,7 +21,7 @@ import tempfile
from dataclasses import dataclass, field
from pathlib import Path
import sitemarkup as markup
from sitegen import markup
from core.artifacts import write_bytes_atomic
from build_port import ARCHIVES, BATOCERA_ZIP, MUOS_APP, PORT_ZIP, TOOLS_ZIP, build_archive
from core.paths import REPO_ROOT
File renamed without changes.
@@ -32,9 +32,9 @@ from dataclasses import dataclass
from pathlib import Path
import measurement_records as mr
import sitemarkup as markup
from sitegen import markup
from core.artifacts import json_text, write_if_changed
from siterender import _escape_tags
from sitegen.render import _escape_tags
from core.paths import REPO_ROOT
ROOT = REPO_ROOT
@@ -7,7 +7,7 @@ import urllib.parse
from collections.abc import Callable
from model import siteinputs
import sitemarkup as markup
from sitegen import markup
from core.paths import REPO_ROOT
from model.collection import _PROGRAM_TOPS, _card_moves, _manufacturer_slug
from model.systemnames import (
@@ -431,7 +431,7 @@ def page_aliases(rel: str) -> list[str]:
(psx, dreamcast, gba), from siterender.system_search_aliases(): "psx
bios" finds the PlayStation page though the page never says psx."""
if not _page_aliases_built[0]:
import siterender
from sitegen import render as siterender
by_page: dict[str, set[str]] = {}
for sys_id in list(siterender._system_page_map):
@@ -23,7 +23,7 @@ from __future__ import annotations
from dataclasses import dataclass
from xml.sax.saxutils import escape
import sitemarkup as markup
from sitegen import markup
from sitediagrams import (
MONO_STYLE,
NARROW,
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -16,7 +16,7 @@ from dataclasses import dataclass
from pathlib import Path
from core import upstream
from siterender import _by_mode, _escape_tags
from sitegen.render import _by_mode, _escape_tags
from model.sourceref import (
_HEX_ADDRESS_RE,
_prose_runs,