mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
refactor: site modules into the sitegen package
This commit is contained in:
1 parent
29f5c48a2c
commit
206dae3163
57 files changed
+98
-97
No files matched your search
@@ -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
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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
@@ -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
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
@@ -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,
|
||||
|
||||
@@ -59,7 +59,7 @@ class ReadmeRegressions(unittest.TestCase):
|
||||
)[0]
|
||||
|
||||
def test_advertised_bootstrap_urls_are_the_shipped_ones(self):
|
||||
import sitebootstrap
|
||||
from sitegen import bootstrap as sitebootstrap
|
||||
from model.guides import INSTALL_BASE
|
||||
|
||||
quick_install = self._quick_install()
|
||||
@@ -5794,7 +5794,7 @@ class SiteCodeSpansHoldTheirValue(unittest.TestCase):
|
||||
was read as markup."""
|
||||
|
||||
def test_a_backtick_cannot_close_the_span(self):
|
||||
from scripts.siterender import _code
|
||||
from scripts.sitegen.render import _code
|
||||
|
||||
span = _code("a`<img src=x onerror=alert(1)>`")
|
||||
self.assertEqual(span.count("`"), 2)
|
||||
|
||||
@@ -30,7 +30,7 @@ from scraper.batocera_scraper import (
|
||||
platform_systems,
|
||||
requirements_from_systems,
|
||||
)
|
||||
from siteexports import describe_change
|
||||
from sitegen.exports import describe_change
|
||||
from packs.verdicts import Status, verify_entry_md5
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -1625,7 +1625,7 @@ def unserved_one_liners(page: str, text: str) -> list[str]:
|
||||
"""One-line commands whose address the site does not serve. The raw
|
||||
address of the repository stays as the fallback of the One line
|
||||
section, and must name a bootstrap the repository holds."""
|
||||
import sitebootstrap
|
||||
from sitegen import bootstrap as sitebootstrap
|
||||
from model.guides import INSTALL_BASE
|
||||
|
||||
served = {f"{INSTALL_BASE}/{name}" for name in sitebootstrap.SOURCES}
|
||||
|
||||
@@ -17,7 +17,7 @@ from pathlib import Path
|
||||
from exporter import native
|
||||
from exporter.landed import landed_changes
|
||||
from exporter.native import current_truth, export_platform, write_report
|
||||
from siteexports import generate_exports_page, load_export_reports
|
||||
from sitegen.exports import generate_exports_page, load_export_reports
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -150,7 +150,7 @@ class ThePageAddressesMaintainersAsPeers(unittest.TestCase):
|
||||
their work, which the page is not."""
|
||||
|
||||
def test_the_change_sentence_is_built_from_the_numbers(self):
|
||||
from siteexports import change_text
|
||||
from sitegen.exports import change_text
|
||||
|
||||
report = _report("batocera", ["batocera-systems"],
|
||||
hashes_updated=["a md5", "b md5"], required_aligned=3)
|
||||
|
||||
@@ -24,7 +24,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import measurement_records as mr
|
||||
import sitemeasurements as sm
|
||||
from sitegen import measurements as sm
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -222,13 +222,13 @@ class SitePages(unittest.TestCase):
|
||||
and reach no page."""
|
||||
|
||||
def test_the_pack_blocks_are_gone(self) -> None:
|
||||
import sitemeasurements as sm
|
||||
from sitegen import measurements as sm
|
||||
|
||||
for name in ("pack_summary", "packs_section", "pack_tested_section", "by_platform"):
|
||||
self.assertFalse(hasattr(sm, name), name)
|
||||
|
||||
def test_pack_runs_stay_off_the_emulator_page(self) -> None:
|
||||
import sitemeasurements as sm
|
||||
from sitegen import measurements as sm
|
||||
|
||||
subject = pp.subject_for("retroarch", "pack", "sega-saturn", "mednafen_saturn", "Game (Japan)")
|
||||
self.assertEqual(subject, "pack-retroarch-pack-sega-saturn-mednafen-saturn-game-japan")
|
||||
@@ -239,7 +239,7 @@ class SitePages(unittest.TestCase):
|
||||
|
||||
def test_a_markdown_link_keeps_only_safe_targets(self) -> None:
|
||||
"""A Markdown link in site text keeps only http(s) and relative targets."""
|
||||
import sitemarkup
|
||||
from sitegen import markup as sitemarkup
|
||||
|
||||
self.assertEqual(sitemarkup.inline_html("[x](javascript:alert(1))"), "[x](javascript:alert(1))")
|
||||
self.assertEqual(sitemarkup.inline_html('[x](https://a.org/"onmouseover=1)'),
|
||||
|
||||
@@ -243,7 +243,7 @@ class SitePages(unittest.TestCase):
|
||||
"""No page shows region outcomes. The Beetle PSX page names the runs
|
||||
its required: false rests on, each with the BIOS the core ran."""
|
||||
import measurement_records as mr
|
||||
import sitemeasurements as sm
|
||||
from sitegen import measurements as sm
|
||||
|
||||
stored = mr.read_records(ROOT)
|
||||
index = sm.build_index(stored, {"repo": sm.REPO, "commit": "0" * 40}, sm.load_profiles(ROOT / "emulators"),
|
||||
|
||||
@@ -11,7 +11,7 @@ import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import siteagents
|
||||
from sitegen import agents as siteagents
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
from core.anchors import toc_slug
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import install
|
||||
import sitebootstrap
|
||||
from sitegen import bootstrap as sitebootstrap
|
||||
from model import guides
|
||||
from model.guides import INSTALL_BASE, INSTALL_PS1, INSTALL_SH, install_command
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class TheRules(unittest.TestCase):
|
||||
"""What the gate reads without a build."""
|
||||
|
||||
def test_the_logo_reaches_the_front_matter(self):
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
_target, text = sitestarlight.render_page(
|
||||
"platforms/x.md",
|
||||
|
||||
@@ -358,7 +358,7 @@ class TitleLogoOnAPlate(unittest.TestCase):
|
||||
def test_a_setup_with_no_logo_gets_its_initials(self):
|
||||
# Every setup has a logo today: the fallback is read where it is
|
||||
# written, the tile's and the title's.
|
||||
import sitemarkup
|
||||
from sitegen import markup as sitemarkup
|
||||
|
||||
self.assertIn('data-initials="MM" aria-hidden="true"></span>', sitemarkup._tile_mark("MyMinUI", ""))
|
||||
component = _read(REPO_ROOT / "website" / "src" / "components" / "PageTitle.astro")
|
||||
@@ -381,8 +381,8 @@ class OneTabIsNoTabBar(unittest.TestCase):
|
||||
the heading "On the device"."""
|
||||
|
||||
def test_a_single_item_stands_alone(self):
|
||||
import sitemarkup
|
||||
import siteguides
|
||||
from sitegen import markup as sitemarkup
|
||||
from sitegen import guides as siteguides
|
||||
|
||||
self.assertEqual(sitemarkup.tabs([("Linux", ["run it"])]), ["**Linux**", "", "run it", ""])
|
||||
self.assertEqual(sitemarkup.tabs([("", ["run it"])]), ["run it", ""])
|
||||
|
||||
@@ -21,7 +21,7 @@ from pathlib import Path
|
||||
|
||||
import generate_readme
|
||||
import make_demo
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from html.parser import HTMLParser
|
||||
from pathlib import Path
|
||||
|
||||
import generate_site as gs
|
||||
import sitemarkup as markup
|
||||
from sitegen import markup
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import importlib.util
|
||||
import json
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
import validate_site
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ import generate_readme
|
||||
import generate_site
|
||||
import release_record
|
||||
from model import guides
|
||||
import sitemarkup
|
||||
from sitegen import markup as sitemarkup
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import load_platform_registry
|
||||
from tests import sitepages
|
||||
|
||||
@@ -20,7 +20,7 @@ from pathlib import Path
|
||||
import yaml
|
||||
|
||||
import generate_site as gs
|
||||
import siteentries
|
||||
from sitegen import entries as siteentries
|
||||
import validate_site
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -1113,7 +1113,7 @@ class NestedProfileBlocksRenderAsLists(unittest.TestCase):
|
||||
import markdown
|
||||
except ImportError:
|
||||
self.skipTest("markdown is not installed")
|
||||
from siterender import _render_yaml_value
|
||||
from sitegen.render import _render_yaml_value
|
||||
|
||||
# The page opens the block with ???+ (pymdownx.details). An admonition
|
||||
# nests its body by the same four spaces, and needs nothing CI lacks.
|
||||
@@ -1192,7 +1192,7 @@ class TheOneLinerIsWhereUsersLand(unittest.TestCase):
|
||||
|
||||
def test_a_system_is_offered_only_where_the_manifest_records_it(self):
|
||||
import generate_site
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
|
||||
saved = dict(siterender._system_page_map)
|
||||
self.addCleanup(siterender.set_system_page_map, saved)
|
||||
|
||||
@@ -14,7 +14,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import indexnow
|
||||
import siteagents
|
||||
from sitegen import agents as siteagents
|
||||
import site_markdown
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -211,7 +211,7 @@ class DeepLinksCarryALabel(unittest.TestCase):
|
||||
ANSWERS = ("/retrobios/wiki/technical-faq/#which-mame-version-do-the-arcade-bios-sets-match",)
|
||||
|
||||
def test_start_and_setup_pages(self):
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
pages = _docs_pages()
|
||||
levels = {page: _level(page) for page in pages}
|
||||
|
||||
@@ -22,7 +22,7 @@ from unittest import mock
|
||||
|
||||
import build_port
|
||||
from model.registry import list_registered_platforms
|
||||
import sitehandheld
|
||||
from sitegen import handheld as sitehandheld
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ class SharingCards(unittest.TestCase):
|
||||
ET.fromstring(sitediagrams.og_card_svg(section, mark))
|
||||
|
||||
def test_the_template_names_every_section(self):
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
named = {sitestarlight.og_section("index.md", "")} | {
|
||||
sitestarlight.og_section("wiki/page.md", level)
|
||||
|
||||
@@ -34,7 +34,7 @@ import ast
|
||||
from html import unescape
|
||||
|
||||
import generate_site
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
from core import anchors as core_anchors
|
||||
from model.registry import list_registered_platforms, load_platform_registry
|
||||
from model.platforms import load_platform_config
|
||||
|
||||
@@ -23,8 +23,8 @@ from html.parser import HTMLParser
|
||||
from pathlib import Path
|
||||
|
||||
import sitediagrams
|
||||
import siteentries
|
||||
import sitesteps
|
||||
from sitegen import entries as siteentries
|
||||
from sitegen import steps as sitesteps
|
||||
from model.guides import TERMINALS
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -38,7 +38,7 @@ def picked(data: dict, chosen: set[str]) -> list[str]:
|
||||
|
||||
class PickerMatchesInstaller(unittest.TestCase):
|
||||
def setUp(self):
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
self.folder = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp" if (REPO_ROOT / "tmp").is_dir() else None)
|
||||
self.out = Path(self.folder.name)
|
||||
|
||||
@@ -52,7 +52,7 @@ import runpy
|
||||
import urllib.error
|
||||
|
||||
import generate_site
|
||||
import sitewanted
|
||||
from sitegen import wanted as sitewanted
|
||||
from model import systemnames
|
||||
from model.registry import list_registered_platforms, list_release_pack_platforms
|
||||
from model.profiles import load_emulator_profiles
|
||||
@@ -1083,7 +1083,7 @@ class EverySystemIdWithFilesHasAPage(unittest.TestCase):
|
||||
|
||||
def test_first_file_then_emulator(self):
|
||||
files = {"f" * 40: {"path": "bios/DOS/DOS/a.bin"}}
|
||||
with mock.patch("siterender._card_pages", {}):
|
||||
with mock.patch("sitegen.render._card_pages", {}):
|
||||
place = generate_site._first_file_place(
|
||||
"dos", ["f" * 40], files, {}, lambda path, sha1: "dos")
|
||||
self.assertEqual(place, ("DOS", "/retrobios/systems/dos/#sha1-ffffffffffff"))
|
||||
|
||||
@@ -11,7 +11,7 @@ from unittest import mock
|
||||
|
||||
import yaml
|
||||
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -534,7 +534,7 @@ class NoTooltipInsideAName(unittest.TestCase):
|
||||
Free Unix Spectrum Emulator, Windows Terminal, Documents/Dolphin Emulator."""
|
||||
|
||||
def test_names_are_left_and_terms_are_marked(self):
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
|
||||
terms = {"Emulator": "An app that acts like a console.",
|
||||
"Terminal": "A window for typing commands.",
|
||||
|
||||
@@ -31,7 +31,7 @@ import json
|
||||
from html.parser import HTMLParser
|
||||
|
||||
import generate_site as gs
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
import validate_site
|
||||
import generate_site
|
||||
from model.registry import list_registered_platforms
|
||||
|
||||
@@ -17,7 +17,7 @@ import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
|
||||
import sitediagrams
|
||||
import sitesteps
|
||||
from sitegen import steps as sitesteps
|
||||
from model.guides import TERMINALS
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -18,7 +18,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -76,14 +76,14 @@ class OtherSpellingsOfOneSystem(unittest.TestCase):
|
||||
self.assertEqual(gs._system_emulators("nintendo-snes", index), [])
|
||||
|
||||
def _install(self, mapping: dict) -> None:
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
|
||||
saved = dict(siterender._system_page_map)
|
||||
self.addCleanup(siterender.set_system_page_map, saved)
|
||||
siterender.set_system_page_map(mapping)
|
||||
|
||||
def test_a_profile_spelling_finds_the_platform_page(self):
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
|
||||
self._install({"sega-mega-drive": ("sega", "Mega Drive")})
|
||||
self.assertEqual(siterender._page_by_norm("sega-megadrive"), ("sega", "Mega Drive"))
|
||||
@@ -94,7 +94,7 @@ class OtherSpellingsOfOneSystem(unittest.TestCase):
|
||||
def test_a_table_of_the_same_size_replaces_the_other_spellings(self):
|
||||
"""The index of other spellings was kept while the table kept its
|
||||
length, so a second table of one entry linked to the first one's page."""
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
|
||||
self._install({"sega-mega-drive": ("sega", "Mega Drive")})
|
||||
self.assertEqual(siterender._page_by_norm("sega-megadrive"), ("sega", "Mega Drive"))
|
||||
@@ -281,7 +281,7 @@ class EverySystemLinkLandsOnItsSection(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
import re
|
||||
|
||||
import sitestarlight
|
||||
from sitegen import starlight as sitestarlight
|
||||
from model.registry import list_registered_platforms
|
||||
from model.database import load_database
|
||||
from model.profiles import load_emulator_profiles
|
||||
|
||||
@@ -22,7 +22,7 @@ import unittest
|
||||
from collections.abc import Iterable
|
||||
from pathlib import Path
|
||||
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -41,7 +41,7 @@ import zipfile
|
||||
import json
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
from model import systemnames
|
||||
from packs.crossref import FileConsumers
|
||||
import make_og_cards
|
||||
@@ -630,7 +630,7 @@ class InstallBoxesCountTowardTheSummary(unittest.TestCase):
|
||||
and the page passed its 600 KB budget once the DS files were refiled."""
|
||||
|
||||
def setUp(self) -> None:
|
||||
import siterender
|
||||
from sitegen import render as siterender
|
||||
|
||||
siterender.reset_console_pages()
|
||||
self.addCleanup(siterender.reset_console_pages)
|
||||
|
||||
@@ -39,7 +39,7 @@ class ProsePlaceholders(unittest.TestCase):
|
||||
"""A path written with angle brackets reaches the reader as written."""
|
||||
|
||||
def test_a_placeholder_is_text_not_a_tag(self):
|
||||
from siterender import _admonition_body, _escape_tags
|
||||
from sitegen.render import _admonition_body, _escape_tags
|
||||
|
||||
self.assertEqual(
|
||||
_escape_tags("gameProfiles/<title id>.ini under <system_dir>/Cemu"),
|
||||
@@ -48,7 +48,7 @@ class ProsePlaceholders(unittest.TestCase):
|
||||
self.assertIn("<title id>", _admonition_body("read <title id>.ini"))
|
||||
|
||||
def test_code_spans_and_links_are_left_alone(self):
|
||||
from siterender import _escape_tags
|
||||
from sitegen.render import _escape_tags
|
||||
|
||||
self.assertEqual(_escape_tags("`<system_dir>/x`"), "`<system_dir>/x`")
|
||||
self.assertEqual(_escape_tags("see <https://example.org/a>"), "see <https://example.org/a>")
|
||||
|
||||
@@ -25,7 +25,7 @@ import zlib
|
||||
from pathlib import Path
|
||||
|
||||
import generate_site
|
||||
import sitewanted
|
||||
from sitegen import wanted as sitewanted
|
||||
from resolve import review
|
||||
import yaml
|
||||
from model.database import load_database
|
||||
|
||||
@@ -14,9 +14,9 @@ import tests
|
||||
import unittest
|
||||
|
||||
import generate_site
|
||||
import sitestarlight
|
||||
import siterender
|
||||
import sitemarkup as markup
|
||||
from sitegen import starlight as sitestarlight
|
||||
from sitegen import render as siterender
|
||||
from sitegen import markup
|
||||
from packs.crossref import FileConsumers
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import sitewrite
|
||||
from sitegen import write as sitewrite
|
||||
|
||||
BODY = "# Title\n\nSome prose.\n\n*Generated on 2026-01-01T00:00:00Z*\n"
|
||||
FRONT = (
|
||||
|
||||
Reference in new issue
Block a user