mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-03 06:48:52 -06:00
fix: pack readme reads the guides of its run
model.guides took its platforms folder from the site's inputs, so a pack built with --platforms-dir printed the manual and install commands of the repository's guides. The loaders now take the folder (or the install address) explicitly; sitegen.guidedata binds them to the site's inputs, the pack README to the run's platforms folder, the release notes and the site validation to the folder they were given.
This commit is contained in:
1 parent
2559dfba79
commit
dedbde7917
41 files changed
+258
-170
No files matched your search
+29
-63
@@ -3,12 +3,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
from dataclasses import dataclass, fields
|
||||
from pathlib import Path
|
||||
|
||||
from model import siteinputs
|
||||
from model.registry import load_platform_registry
|
||||
from model.sources import source_yaml
|
||||
|
||||
@@ -409,101 +409,67 @@ def _guides_in(platforms: Path) -> dict:
|
||||
return load_guides(platforms / GUIDES_NAME)
|
||||
|
||||
|
||||
def loaded() -> dict:
|
||||
"""The guides of the platforms folder the run describes, read on first use."""
|
||||
return _guides_in(siteinputs.current().platforms)
|
||||
def loaded(platforms: str | os.PathLike[str]) -> dict:
|
||||
"""The guides of a platforms folder, read once per folder."""
|
||||
return _guides_in(Path(platforms))
|
||||
|
||||
|
||||
def platform_guides() -> dict[str, Guide]:
|
||||
return loaded()["guides"]
|
||||
def install_base(platforms: str | os.PathLike[str]) -> str:
|
||||
return loaded(platforms)["install_base"]
|
||||
|
||||
|
||||
def install_base() -> str:
|
||||
return loaded()["install_base"]
|
||||
def install_sh(base: str) -> str:
|
||||
"""The sh bootstrap the site at *base* serves (sitegen/bootstrap.py writes it)."""
|
||||
return f"{base}/{SH_NAME}"
|
||||
|
||||
|
||||
def install_sh() -> str:
|
||||
"""The sh bootstrap the site serves (sitegen/bootstrap.py writes it)."""
|
||||
return f"{install_base()}/{SH_NAME}"
|
||||
def install_ps1(base: str) -> str:
|
||||
"""The PowerShell bootstrap the site at *base* serves."""
|
||||
return f"{base}/{PS1_NAME}"
|
||||
|
||||
|
||||
def install_ps1() -> str:
|
||||
"""The PowerShell bootstrap the site serves."""
|
||||
return f"{install_base()}/{PS1_NAME}"
|
||||
|
||||
|
||||
def device_groups() -> dict[str, tuple[str, str]]:
|
||||
return loaded()["device_groups"]
|
||||
|
||||
|
||||
def group_anchors() -> dict[str, str]:
|
||||
return loaded()["group_anchors"]
|
||||
|
||||
|
||||
def also_runs() -> dict[str, tuple[tuple[str, str, str, str, str], ...]]:
|
||||
return loaded()["also_runs"]
|
||||
|
||||
|
||||
def group_tiles() -> dict[str, tuple[Tile, ...]]:
|
||||
return loaded()["tiles"]
|
||||
|
||||
|
||||
def handheld_guide() -> HandheldGuide | None:
|
||||
return loaded()["handheld_guide"]
|
||||
|
||||
|
||||
def terminals() -> dict[str, tuple[str, str, str]]:
|
||||
return loaded()["terminals"]
|
||||
|
||||
|
||||
def trust_items() -> tuple[str, ...]:
|
||||
return loaded()["trust_items"]
|
||||
|
||||
|
||||
def folder_list(name: str, registry: dict | None = None) -> list[tuple[str, str]]:
|
||||
def folder_list(name: str, platforms: str | os.PathLike[str],
|
||||
registry: dict | None = None) -> list[tuple[str, str]]:
|
||||
"""Every folder a guide names, as (where, path): the common ones, the
|
||||
rarer builds, and the systems the registry detects when the guide says so."""
|
||||
guide = platform_guides()[name]
|
||||
data = loaded(platforms)
|
||||
guide = data["guides"][name]
|
||||
rows = [*guide.folders, *guide.more_folders]
|
||||
if guide.more_folders_detected:
|
||||
rows += [(system, f"`{folder}`")
|
||||
for system, folder in detected_systems(registry or loaded()["registry"], name)]
|
||||
for system, folder in detected_systems(registry or data["registry"], name)]
|
||||
return rows
|
||||
|
||||
|
||||
def _plain_folders(name: str) -> str:
|
||||
rows = folder_list(name)
|
||||
def _plain_folders(name: str, platforms: str | os.PathLike[str]) -> str:
|
||||
rows = folder_list(name, platforms)
|
||||
width = max(len(where) for where, _path in rows) + 1
|
||||
return "\n".join(f"{where + ':':<{width}} {path.replace('`', '')}" for where, path in rows)
|
||||
|
||||
|
||||
def setup_count() -> int:
|
||||
"""Setups the site covers: every registered platform, since each keeps
|
||||
its page, its pack and its command. The one count every page states."""
|
||||
return len(platform_guides())
|
||||
|
||||
|
||||
def pack_manual(name: str) -> str:
|
||||
def pack_manual(name: str, platforms: str | os.PathLike[str]) -> str:
|
||||
"""The manual part of a pack README, indented as the README is, or empty."""
|
||||
guide = platform_guides().get(name)
|
||||
guide = loaded(platforms)["guides"].get(name)
|
||||
if not guide or not guide.pack_manual:
|
||||
return ""
|
||||
text = guide.pack_manual.rstrip("\n")
|
||||
if "{folders}" in text:
|
||||
indent = next(line[: len(line) - len(line.lstrip())]
|
||||
for line in text.splitlines() if "{folders}" in line)
|
||||
text = text.replace("{folders}", textwrap.indent(_plain_folders(name), indent).lstrip())
|
||||
text = text.replace("{folders}",
|
||||
textwrap.indent(_plain_folders(name, platforms), indent).lstrip())
|
||||
return textwrap.indent(text, " ") + "\n\n"
|
||||
|
||||
|
||||
def install_command(shell: str, args: str = "") -> str:
|
||||
"""The one-liner for a shell, with installer options when given.
|
||||
def install_command(shell: str, args: str = "", *, base: str) -> str:
|
||||
"""The one-liner for a shell, with installer options when given, from
|
||||
the site at *base*.
|
||||
|
||||
PowerShell passes options only through a scriptblock: `irm ... | iex`
|
||||
takes none.
|
||||
"""
|
||||
if shell == "sh":
|
||||
return f"curl -fsSL {install_sh()} | sh" + (f" -s -- {args}" if args else "")
|
||||
return f"curl -fsSL {install_sh(base)} | sh" + (f" -s -- {args}" if args else "")
|
||||
if args:
|
||||
return f"&([scriptblock]::Create((irm {install_ps1()}))) {args}"
|
||||
return f"irm {install_ps1()} | iex"
|
||||
return f"&([scriptblock]::Create((irm {install_ps1(base)}))) {args}"
|
||||
return f"irm {install_ps1(base)} | iex"
|
||||
@@ -974,6 +974,7 @@ class _PlatformPackBuild:
|
||||
readme_text = build_readme(
|
||||
plan.platform_name, plan.platform_display, plan.base_dest, self.total_files,
|
||||
len(plan.pack_systems),
|
||||
platforms_dir=plan.platforms_dir,
|
||||
source=opts.source,
|
||||
contributors=registry.get("contributed_by", []),
|
||||
regions=opts.regions,
|
||||
|
||||
+36
-16
@@ -5,11 +5,14 @@ goes, and which ones the user has to rename."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.options import reject_unknown
|
||||
from core.paths import PLATFORMS_DIR, REPO_ROOT
|
||||
from model.region import label as region_label
|
||||
from model.guides import install_command, pack_manual
|
||||
from model.guides import GUIDES_NAME, install_base, install_command, pack_manual
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Unpack
|
||||
@@ -24,7 +27,16 @@ def _detect_systems(detect: list[dict]) -> list[str]:
|
||||
return [name for name in order if name in seen]
|
||||
|
||||
|
||||
def _from_pack(platform_name: str, posix: bool, windows: bool,
|
||||
def _guides_dir(platforms_dir: str | os.PathLike[str]) -> Path:
|
||||
"""The folder whose guides describe a pack: the run's own platforms
|
||||
folder, or the repository's when that folder holds no guides file (a
|
||||
test tree, a partial copy), the one other place the install address is
|
||||
written."""
|
||||
folder = Path(platforms_dir)
|
||||
return folder if (folder / GUIDES_NAME).is_file() else REPO_ROOT / PLATFORMS_DIR
|
||||
|
||||
|
||||
def _from_pack(platform_name: str, posix: bool, windows: bool, base: str,
|
||||
dest: tuple[str, str] = ("", "")) -> list[str]:
|
||||
"""The same command, reading the files from the ZIP in hand. The
|
||||
one-liner alone downloads every file again."""
|
||||
@@ -32,14 +44,14 @@ 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" {install_command('sh', f'{args} /path/to/pack.zip{dest[0]}')}")
|
||||
lines.append(f" {install_command('sh', f'{args} /path/to/pack.zip{dest[0]}', base=base)}")
|
||||
if windows:
|
||||
pack = f"{args} C:\\path\\to\\pack.zip{dest[1]}"
|
||||
lines.append(f" {install_command('powershell', pack)}")
|
||||
lines.append(f" {install_command('powershell', pack, base=base)}")
|
||||
return [*lines, ""]
|
||||
|
||||
|
||||
def _card_section(platform_name: str, display: str) -> str:
|
||||
def _card_section(platform_name: str, display: str, base: str) -> str:
|
||||
"""The one-line install for a frontend whose files live on its SD card.
|
||||
|
||||
The installer runs on the computer the card is mounted on, and the card
|
||||
@@ -51,12 +63,13 @@ 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" {install_command('sh', f'--platform {platform_name} --dest /path/to/card')}\n\n"
|
||||
f" {install_command('sh', f'--platform {platform_name} --dest /path/to/card', base=base)}\n\n"
|
||||
" Windows: run this in PowerShell (E: being the card):\n\n"
|
||||
f" {install_command('powershell', card_ps1)}\n\n"
|
||||
f" {install_command('powershell', card_ps1, base=base)}\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:\\")))
|
||||
+ "\n".join(_from_pack(platform_name, True, True, base,
|
||||
(" --dest /path/to/card", " --dest E:\\")))
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
@@ -79,6 +92,7 @@ def _card_manual(display: str) -> str:
|
||||
|
||||
def _automatic_section(
|
||||
platform_name: str, display: str, detect: list[dict], standalone_copies: list[dict] | None,
|
||||
base: str,
|
||||
) -> str:
|
||||
"""The one-line install, for every system the registry detects the
|
||||
platform on. Written per platform by hand, it left ROCKNIX and MiSTer
|
||||
@@ -101,14 +115,15 @@ 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" {install_command('sh')}", ""]
|
||||
lines += [f" {where}", "", f" {install_command('sh', base=base)}", ""]
|
||||
if "windows" in systems:
|
||||
lines += [" Windows: run this in PowerShell:", "", f" {install_command('powershell')}", ""]
|
||||
lines += [" Windows: run this in PowerShell:", "",
|
||||
f" {install_command('powershell', base=base)}", ""]
|
||||
lines += [
|
||||
f" The installer finds the {display} BIOS folder on this machine and",
|
||||
" installs there, checking every file. --dest names another folder.",
|
||||
"",
|
||||
*_from_pack(platform_name, bool(posix), "windows" in systems),
|
||||
*_from_pack(platform_name, bool(posix), "windows" in systems, base),
|
||||
]
|
||||
# On a desktop: an emulator folder under the home of a console's own
|
||||
# system is not one its frontend reads.
|
||||
@@ -120,9 +135,9 @@ def _automatic_section(
|
||||
"",
|
||||
]
|
||||
if posix:
|
||||
lines.append(f" {install_command('sh', '--standalone-copies')}")
|
||||
lines.append(f" {install_command('sh', '--standalone-copies', base=base)}")
|
||||
if "windows" in systems:
|
||||
lines.append(f" {install_command('powershell', '--standalone-copies')}")
|
||||
lines.append(f" {install_command('powershell', '--standalone-copies', base=base)}")
|
||||
lines.append("")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
@@ -213,6 +228,7 @@ class ReadmeOptions(TypedDict, total=False):
|
||||
save_where: str
|
||||
save_by_system: bool
|
||||
case_twins: list[tuple[str, str]] | None
|
||||
platforms_dir: str
|
||||
|
||||
|
||||
def build_readme(
|
||||
@@ -235,6 +251,8 @@ def build_readme(
|
||||
packed file, with the one it holds: given for a platform that also runs
|
||||
where names keep their case (EmuDeck and RetroArch on Linux), where the
|
||||
core asking for the other spelling finds nothing.
|
||||
``platforms_dir`` is the run's platforms folder, whose guides give the
|
||||
manual and the install address (the repository's when not given).
|
||||
"""
|
||||
reject_unknown("build_readme", options, ReadmeOptions.__optional_keys__)
|
||||
regions = options.get("regions")
|
||||
@@ -295,21 +313,23 @@ def _install_guide(
|
||||
platform_name: str, platform_display: str, base_dest: str, options: ReadmeOptions
|
||||
) -> str:
|
||||
"""The installation steps, the case twins and the save folder."""
|
||||
guides_dir = _guides_dir(options.get("platforms_dir") or REPO_ROOT / PLATFORMS_DIR)
|
||||
base = install_base(guides_dir)
|
||||
detect = list(options.get("detect") or [])
|
||||
bios_paths = [str(rule.get("bios_path", "")) for rule in detect]
|
||||
if any(rule.get("method") == "card_marker" for rule in detect):
|
||||
guide = (
|
||||
"INSTALLATION GUIDE\n\n"
|
||||
+ _card_section(platform_name, platform_display)
|
||||
+ _card_section(platform_name, platform_display, base)
|
||||
+ _card_manual(platform_display)
|
||||
)
|
||||
else:
|
||||
guide = (
|
||||
"INSTALLATION GUIDE\n\n"
|
||||
+ _automatic_section(
|
||||
platform_name, platform_display, detect, options.get("standalone_copies")
|
||||
platform_name, platform_display, detect, options.get("standalone_copies"), base
|
||||
)
|
||||
+ (pack_manual(platform_name) or _generic_manual(bios_paths))
|
||||
+ (pack_manual(platform_name, guides_dir) or _generic_manual(bios_paths))
|
||||
)
|
||||
|
||||
case_twins = options.get("case_twins")
|
||||
|
||||
@@ -8,7 +8,7 @@ from collections.abc import Callable
|
||||
|
||||
from core.text import series
|
||||
from core.sizes import size_text
|
||||
from model.guides import install_command
|
||||
from model.guides import install_base, install_command
|
||||
from model.platforms import load_platform_config
|
||||
from model.releaserecord import pack_label, pack_owner
|
||||
from model.registry import (
|
||||
@@ -186,6 +186,7 @@ def render(record: dict, platforms_dir: str, whats_new: str,
|
||||
packs = record.get("packs", {})
|
||||
folders = _extract_folders(record, platforms_dir)
|
||||
tag = str(record.get("tag", ""))
|
||||
base = install_base(platforms_dir)
|
||||
lines = [
|
||||
"### Get the BIOS files",
|
||||
"",
|
||||
@@ -193,12 +194,12 @@ def render(record: dict, platforms_dir: str, whats_new: str,
|
||||
"",
|
||||
"**Linux, macOS, Steam Deck**",
|
||||
"```sh",
|
||||
install_command("sh"),
|
||||
install_command("sh", base=base),
|
||||
"```",
|
||||
"",
|
||||
"**Windows**",
|
||||
"```powershell",
|
||||
install_command("powershell"),
|
||||
install_command("powershell", base=base),
|
||||
"```",
|
||||
"",
|
||||
f"**On a handheld**: [get the app for the system]({SITE}{HANDHELD_PAGE}).",
|
||||
|
||||
@@ -19,7 +19,8 @@ import json
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
from model.guides import PACKAGE_COMMAND, install_command
|
||||
from model.guides import PACKAGE_COMMAND
|
||||
from sitegen.guidedata import install_command
|
||||
from sitegen.config import SITE_ORIGIN, SITE_URL
|
||||
|
||||
SITE = SITE_URL
|
||||
|
||||
@@ -19,7 +19,7 @@ from model.collection import group_by_manufacturer, manufacturer_slug
|
||||
from model.composition import compute_composition
|
||||
from model.database import load_database
|
||||
from model.dumpcatalog import load_provenance_snapshots
|
||||
from model.guides import handheld_guide
|
||||
from sitegen.guidedata import handheld_guide
|
||||
from model.profiles import is_emulator, lists_files, load_emulator_profiles
|
||||
from model.registry import list_registered_platforms, load_platform_registry
|
||||
from model.systemnames import program_names, set_console_sections, system_name
|
||||
|
||||
@@ -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 sitegen.guidedata 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
|
||||
|
||||
@@ -405,7 +405,7 @@ def _setups_in(platforms_dir: str) -> tuple[str, ...]:
|
||||
|
||||
def setups_named(named: list[str]) -> str:
|
||||
"""*named*, then how many other setups there are: "A, B and 15 more"."""
|
||||
from model.guides import setup_count
|
||||
from sitegen.guidedata import setup_count
|
||||
|
||||
others = setup_count() - len(named)
|
||||
return ", ".join(named) + (f" and {others} more" if others else "")
|
||||
|
||||
@@ -7,7 +7,7 @@ import re
|
||||
|
||||
from model import releaserecord
|
||||
from model import siteinputs
|
||||
from model.guides import device_groups, group_tiles, platform_guides, handheld_guide
|
||||
from sitegen.guidedata import device_groups, group_tiles, platform_guides, handheld_guide
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import load_platform_registry
|
||||
from installer_build.handhelds import GROUP_PAGE
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
"""The guides of the platforms folder the site run describes (siteinputs)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from model import guides
|
||||
from model import siteinputs
|
||||
from model.guides import Guide, HandheldGuide, Tile
|
||||
|
||||
|
||||
def loaded() -> dict:
|
||||
return guides.loaded(siteinputs.current().platforms)
|
||||
|
||||
|
||||
def platform_guides() -> dict[str, Guide]:
|
||||
return loaded()["guides"]
|
||||
|
||||
|
||||
def install_base() -> str:
|
||||
return loaded()["install_base"]
|
||||
|
||||
|
||||
def install_sh() -> str:
|
||||
"""The sh bootstrap the site serves (sitegen/bootstrap.py writes it)."""
|
||||
return guides.install_sh(install_base())
|
||||
|
||||
|
||||
def install_ps1() -> str:
|
||||
"""The PowerShell bootstrap the site serves."""
|
||||
return guides.install_ps1(install_base())
|
||||
|
||||
|
||||
def install_command(shell: str, args: str = "") -> str:
|
||||
"""The one-liner for a shell, as the site prints it."""
|
||||
return guides.install_command(shell, args, base=install_base())
|
||||
|
||||
|
||||
def device_groups() -> dict[str, tuple[str, str]]:
|
||||
return loaded()["device_groups"]
|
||||
|
||||
|
||||
def group_anchors() -> dict[str, str]:
|
||||
return loaded()["group_anchors"]
|
||||
|
||||
|
||||
def also_runs() -> dict[str, tuple[tuple[str, str, str, str, str], ...]]:
|
||||
return loaded()["also_runs"]
|
||||
|
||||
|
||||
def group_tiles() -> dict[str, tuple[Tile, ...]]:
|
||||
return loaded()["tiles"]
|
||||
|
||||
|
||||
def handheld_guide() -> HandheldGuide | None:
|
||||
return loaded()["handheld_guide"]
|
||||
|
||||
|
||||
def terminals() -> dict[str, tuple[str, str, str]]:
|
||||
return loaded()["terminals"]
|
||||
|
||||
|
||||
def trust_items() -> tuple[str, ...]:
|
||||
return loaded()["trust_items"]
|
||||
|
||||
|
||||
def folder_list(name: str, registry: dict | None = None) -> list[tuple[str, str]]:
|
||||
"""Every folder a guide names (model.guides.folder_list)."""
|
||||
return guides.folder_list(name, siteinputs.current().platforms, registry)
|
||||
|
||||
|
||||
def setup_count() -> int:
|
||||
"""Setups the site covers: every registered platform, since each keeps
|
||||
its page, its pack and its command. The one count every page states."""
|
||||
return len(platform_guides())
|
||||
@@ -10,13 +10,12 @@ from model import releaserecord
|
||||
from model import siteinputs
|
||||
from model.collection import profiles_on_disk
|
||||
from model.guides import (
|
||||
platform_guides,
|
||||
Guide,
|
||||
HandheldGuide,
|
||||
HandheldSystem,
|
||||
terminals,
|
||||
detected_systems as _detected_systems,
|
||||
)
|
||||
from sitegen.guidedata import platform_guides, terminals
|
||||
from model.registry import load_platform_registry
|
||||
from resolve.nativemode import digest_algorithm
|
||||
from installer_build.handhelds import GROUP_PAGE
|
||||
|
||||
@@ -13,7 +13,8 @@ from __future__ import annotations
|
||||
|
||||
|
||||
from sitegen import markup
|
||||
from model.guides import Guide, terminals, trust_items, install_command
|
||||
from model.guides import Guide
|
||||
from sitegen.guidedata import terminals, trust_items, install_command
|
||||
|
||||
|
||||
# The title over each command block, by the shell it is written for.
|
||||
|
||||
@@ -7,7 +7,8 @@ import html
|
||||
from core.paths import PLATFORMS_DIR
|
||||
from core.sizes import size_text
|
||||
from model.composition import compute_composition
|
||||
from model.guides import device_groups, group_tiles, platform_guides, Guide, trust_items, setup_count
|
||||
from model.guides import Guide
|
||||
from sitegen.guidedata import device_groups, group_tiles, platform_guides, trust_items, setup_count
|
||||
from model.profiles import unique_emulator_profiles
|
||||
from model.registry import load_platform_registry
|
||||
from sitegen import markup
|
||||
|
||||
@@ -11,7 +11,7 @@ from pathlib import Path
|
||||
from core.paths import DB_FILE, PLATFORMS_DIR, REPO_ROOT
|
||||
from model.collection import group_by_manufacturer
|
||||
from model.database import load_database
|
||||
from model.guides import group_tiles, platform_guides
|
||||
from sitegen.guidedata import group_tiles, platform_guides
|
||||
from model.registry import load_platform_registry
|
||||
from scraper.base_scraper import FetchError, fetch_bytes
|
||||
from sitegen.imagenormalize import (
|
||||
|
||||
@@ -13,7 +13,7 @@ from pathlib import Path
|
||||
from core.text import series
|
||||
from model import siteinputs
|
||||
from model.collection import profiles_in
|
||||
from model.guides import platform_guides, terminals, install_command
|
||||
from sitegen.guidedata import platform_guides, terminals, install_command
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import list_release_pack_platforms
|
||||
from model.profiles import reads_own_files
|
||||
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
|
||||
from model.collection import manufacturer_slug
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
from model.guides import device_groups, group_tiles, handheld_guide
|
||||
from sitegen.guidedata import device_groups, group_tiles, handheld_guide
|
||||
from model.profiles import unique_emulator_profiles
|
||||
from sitegen import measurements as sitemeasurements, starlight as sitestarlight
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
@@ -104,7 +104,7 @@ FENCE_TITLES = {"sh": "Terminal", "powershell": "PowerShell"}
|
||||
|
||||
def _installer_args(body: str) -> str:
|
||||
"""The options of a one-line install command, continuation lines joined."""
|
||||
from model.guides import install_sh
|
||||
from sitegen.guidedata import install_sh
|
||||
|
||||
line = " ".join(part.strip().rstrip("\\").strip() for part in body.splitlines())
|
||||
match = re.fullmatch(rf"curl -fsSL {re.escape(install_sh())} \| sh(?: -s -- (.+))?", line)
|
||||
@@ -127,7 +127,7 @@ def expand_commands(markdown: str) -> str:
|
||||
gives a tab its own options, for a folder that differs there."""
|
||||
if "os-tabs" not in markdown:
|
||||
return markdown
|
||||
from model.guides import terminals, install_command
|
||||
from sitegen.guidedata import terminals, install_command
|
||||
|
||||
def replace(match: re.Match[str]) -> str:
|
||||
indent = match.group("indent")
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from model import releaserecord
|
||||
from model.guides import device_groups, group_tiles, platform_guides
|
||||
from sitegen.guidedata import device_groups, group_tiles, platform_guides
|
||||
from resolve.nativemode import check_label
|
||||
from sitegen import markup
|
||||
from sitegen.guidepage import NO_ZIP_FAQ
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import json
|
||||
import re
|
||||
|
||||
from model.guides import platform_guides
|
||||
from sitegen.guidedata import platform_guides
|
||||
from model.systemnames import system_name
|
||||
from resolve.nativemode import check_label, reads_file_contents
|
||||
from sitegen import markup
|
||||
|
||||
@@ -19,7 +19,8 @@ from core.sizes import size_text
|
||||
from core import upstream
|
||||
from installer_build.module import installer_module
|
||||
from model.composition import compute_composition, count_catalog_matched
|
||||
from model.guides import PACKAGE_COMMAND, install_command
|
||||
from model.guides import PACKAGE_COMMAND
|
||||
from sitegen.guidedata import install_command
|
||||
from model.largefiles import load_registered_paths
|
||||
from model.profiles import load_emulator_profiles, unique_emulator_profiles
|
||||
from model.registry import list_registered_platforms
|
||||
|
||||
@@ -419,7 +419,7 @@ def _check_get_pages(
|
||||
"""
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
from model import releaserecord
|
||||
from model.guides import install_sh
|
||||
from model.guides import install_base, install_sh
|
||||
from model.registry import list_registered_platforms, list_release_pack_platforms
|
||||
|
||||
if not (platforms_dir / "_registry.yml").is_file():
|
||||
@@ -444,7 +444,7 @@ def _check_get_pages(
|
||||
packs = [a for a in assets if "_BIOS_Pack" in a]
|
||||
if packs:
|
||||
issues.append(f"{rel}: links a pack for a setup without one: {packs[0]}")
|
||||
if f"{install_sh()} | sh" not in (site / rel).read_text(encoding="utf-8"):
|
||||
if f"{install_sh(install_base(platforms_dir))} | sh" not in (site / rel).read_text(encoding="utf-8"):
|
||||
issues.append(f"{rel}: gives no install command")
|
||||
return issues
|
||||
|
||||
|
||||
@@ -6,13 +6,12 @@ from model import releaserecord
|
||||
from core.sizes import size_text
|
||||
from core.ziptools import build_zip_contents_index
|
||||
from model import siteinputs
|
||||
from model.guides import (
|
||||
from model.guides import Guide, PACKAGE_COMMAND
|
||||
from sitegen.guidedata import (
|
||||
also_runs,
|
||||
device_groups,
|
||||
group_anchors,
|
||||
platform_guides,
|
||||
Guide,
|
||||
PACKAGE_COMMAND,
|
||||
terminals,
|
||||
install_command,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user