mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 06:18:51 -06:00
refactor: tidy the repository root
README.md and CONTRIBUTING.md open with a comment naming their generator, generate_readme.py --check fails on a hand edit in validate.yml and pr_checks.py, and .gitattributes marks the pipeline outputs as generated, held equal to core/generated.py by a test. _mame_clones.json becomes mame_clones.json, still written beside the scanned bios/ tree, and now triggers both workflows (coverage reads it). docs_assets/ moves to website/assets/, which Astro does not read as content. ACCESSIBILITY.md becomes wiki/accessibility.md, linked from the README and the installer page. The screenshot list moves to wiki/images-wanted.md: nothing read docs_assets/screens/. The architecture map names every root entry (test_repository_map), platforms/README.md keeps only what this folder holds, the reference index lists archive-recipes and measurements, and reference-terms no longer defines Profile twice nor repeats the glossary's Pack.
This commit is contained in:
1 parent
5e306ec19f
commit
ab7e300c19
283 files changed
+410
-193
No files matched your search
@@ -8,7 +8,7 @@ from typing import Any
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
OUT = REPO_ROOT / "docs_assets" / "brand"
|
||||
OUT = REPO_ROOT / "website" / "assets" / "brand"
|
||||
PROJECT = REPO_ROOT / ".github" / "assets"
|
||||
|
||||
HEADER = "#3b3f7a"
|
||||
|
||||
@@ -140,12 +140,12 @@ def _write_public_assets(docs: Path, public: Path) -> None:
|
||||
images_dest = public / "assets" / "images"
|
||||
images_dest.mkdir(parents=True, exist_ok=True)
|
||||
# Logos, system icons and sharing cards are served from the site itself
|
||||
# (docs_assets/*/sources.json records where each came from).
|
||||
# (website/assets/*/sources.json records where each came from).
|
||||
# brand: the mark, favicons and touch icon (scripts/make_site_icons.py).
|
||||
folders = [("logos", "logos"), ("system-icons", "system-icons"), ("og", "og"),
|
||||
("brand", "brand")]
|
||||
for folder, dest in folders:
|
||||
source = Path("docs_assets") / folder
|
||||
source = Path("website", "assets") / folder
|
||||
if source.is_dir():
|
||||
shutil.copytree(source, public / "assets" / dest, dirs_exist_ok=True)
|
||||
# The diagrams and the drawn install steps, one SVG per layout and theme.
|
||||
@@ -154,7 +154,7 @@ def _write_public_assets(docs: Path, public: Path) -> None:
|
||||
demo_dest = public / "assets" / "demo"
|
||||
demo_dest.mkdir(parents=True, exist_ok=True)
|
||||
for name in DEMO_ASSETS:
|
||||
shutil.copy2(Path("docs_assets") / "demo" / name, demo_dest / name)
|
||||
shutil.copy2(Path("website", "assets") / "demo" / name, demo_dest / name)
|
||||
assets_src = Path(".github") / "assets"
|
||||
for name, dest_name in [("logo.png", "logo.png"), ("favicon.png", "favicon.png")]:
|
||||
src = assets_src / name
|
||||
|
||||
@@ -122,7 +122,7 @@ def _coverage_inputs(db_path: Path, platforms_dir: str, emulators_dir: str) -> s
|
||||
revisions = sorted({REPO_ROOT / versions_file_for(entry)
|
||||
for entry in load_data_dir_registry(platforms_dir).values()
|
||||
if entry.get("local_cache")})
|
||||
for path in (REPO_ROOT / ".gitignore", REPO_ROOT / "_mame_clones.json", *revisions):
|
||||
for path in (REPO_ROOT / ".gitignore", REPO_ROOT / "mame_clones.json", *revisions):
|
||||
add_file(path)
|
||||
digest.update(b"offline\0" + (b"1" if run_is_offline() else b"0") + b"\n")
|
||||
large = Path(LARGE_FILES_CACHE).resolve()
|
||||
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
OUT = REPO_ROOT / "docs_assets" / "demo"
|
||||
OUT = REPO_ROOT / "website" / "assets" / "demo"
|
||||
WORK = REPO_ROOT / "tmp" / "demo"
|
||||
FACTS = OUT / "demo.json"
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ def first_screen_words() -> list[str]:
|
||||
f"and **{installer.TUI_FOLDER_TITLE}**), then offers **{installer.TUI_INSTALL_ROW}**."]
|
||||
|
||||
|
||||
# The demo files the site serves (docs_assets/demo/, scripts/make_demo.py):
|
||||
# The demo files the site serves (website/assets/demo/, scripts/make_demo.py):
|
||||
# the GIF is the README's, the tape and demo.json are inputs.
|
||||
DEMO_ASSETS = tuple(f"{stem}.{ext}" for stem in ("install", "install-handheld")
|
||||
for ext in ("webm", "mp4", "png"))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The platform logos and system icons the site shows, copied once into docs_assets/."""
|
||||
"""The platform logos and system icons the site shows, copied once into website/assets/."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ from model.platforms import load_platform_config
|
||||
from model.registry import list_registered_platforms
|
||||
from sitegen.diagrams import FONT, setups_named, wrap
|
||||
|
||||
OUT = REPO_ROOT / "docs_assets" / "og"
|
||||
LOGO = REPO_ROOT / "docs_assets" / "brand" / "logo.svg"
|
||||
OUT = REPO_ROOT / "website" / "assets" / "og"
|
||||
LOGO = REPO_ROOT / "website" / "assets" / "brand" / "logo.svg"
|
||||
PLATFORM_TAGLINE = "Which BIOS files it needs, and where each one goes"
|
||||
# The tagline's box on the card: og_card_svg wraps it at this width and
|
||||
# size, and three lines fit above the address.
|
||||
@@ -26,7 +26,7 @@ TAGLINE_WIDTH, TAGLINE_SIZE, TAGLINE_LINES = 1000, 34, 3
|
||||
|
||||
|
||||
# Sharing cards: one 1200x630 card per section of the site, rendered to PNG
|
||||
# once by scripts/make_og_cards.py and committed under docs_assets/og/.
|
||||
# once by scripts/make_og_cards.py and committed under website/assets/og/.
|
||||
|
||||
OG_SECTIONS: dict[str, tuple[str, str]] = {
|
||||
"home": ("BIOS and firmware packs", "Checked file by file, for {frontends}"),
|
||||
@@ -40,7 +40,7 @@ OG_SECTIONS: dict[str, tuple[str, str]] = {
|
||||
|
||||
def og_card_svg(section: str, mark_svg: str) -> str:
|
||||
"""A sharing card. ``mark_svg`` is the site's white mark
|
||||
(docs_assets/brand/logo.svg), drawn as the header draws it."""
|
||||
(website/assets/brand/logo.svg), drawn as the header draws it."""
|
||||
title, tagline = OG_SECTIONS[section]
|
||||
tagline = tagline.format(frontends=setups_named(["RetroArch", "Batocera", "EmuDeck"]))
|
||||
mark = mark_svg.strip().replace("<svg ", '<svg x="96" y="88" width="112" height="112" ', 1)
|
||||
|
||||
@@ -46,8 +46,8 @@ def unresolved_images(markdown: str) -> list[str]:
|
||||
|
||||
# Local copies of images the site used to load from other hosts.
|
||||
|
||||
LOGO_DIR = REPO_ROOT / "docs_assets" / "logos"
|
||||
ICON_DIR = REPO_ROOT / "docs_assets" / "system-icons"
|
||||
LOGO_DIR = REPO_ROOT / "website" / "assets" / "logos"
|
||||
ICON_DIR = REPO_ROOT / "website" / "assets" / "system-icons"
|
||||
SITE_LOGO_DIR = "assets/logos"
|
||||
SITE_ICON_DIR = "assets/system-icons"
|
||||
IMAGE_LINK = re.compile(r"(!\[[^\]\n]*\]\()(https?://[^)\s]+)(\))")
|
||||
|
||||
+31
-12
@@ -14,7 +14,7 @@ from core.text import series
|
||||
from romrecipes import ledger
|
||||
from devtools import prchecks
|
||||
from model import releaserecord, siteinputs
|
||||
from core.artifacts import write_if_changed
|
||||
from core.artifacts import content_differs, write_if_changed
|
||||
from core.paths import DB_FILE, REPO_ROOT
|
||||
from core.sizes import size_text
|
||||
from core import upstream
|
||||
@@ -94,7 +94,7 @@ def collection_line(total_files: int, comp: dict) -> str:
|
||||
|
||||
|
||||
# The installer demo (scripts/make_demo.py): the recording and what it shows.
|
||||
DEMO_GIF = "docs_assets/demo/install.gif"
|
||||
DEMO_GIF = "website/assets/demo/install.gif"
|
||||
REPO = REPO_SLUG
|
||||
README_PATH = REPO_ROOT / "README.md"
|
||||
CONTRIBUTING_PATH = REPO_ROOT / "CONTRIBUTING.md"
|
||||
@@ -372,6 +372,7 @@ def render_readme(inputs: ReadmeInputs) -> str:
|
||||
f"- Have a file? [Check it by its hash]({SITE_URL}files/)",
|
||||
f"- Every console and the files it needs: [systems]({SITE_URL}systems/)",
|
||||
f"- Asking an AI assistant: it reads the site best from [llms.txt]({SITE_URL}llms.txt)",
|
||||
f"- Screen reader, keyboard only or no colour: [accessibility]({SITE_URL}wiki/accessibility/)",
|
||||
"",
|
||||
"## How it is built",
|
||||
"",
|
||||
@@ -612,14 +613,32 @@ def generate_contributing() -> str:
|
||||
)
|
||||
|
||||
|
||||
def write_readme(readme: str) -> None:
|
||||
status = "Generated" if write_if_changed(str(README_PATH), readme) else "Unchanged"
|
||||
print(f"{status} ./README.md")
|
||||
# The first line of both repository files: GitHub renders the comment as
|
||||
# nothing, and whoever opens the file to edit it learns where the text comes from.
|
||||
GENERATED_MARKER = (
|
||||
"<!-- Generated by scripts/generate_readme.py from scripts/sitegen/readme.py."
|
||||
" Edit the generator, then run it: a hand edit fails the Validation workflow. -->\n"
|
||||
)
|
||||
|
||||
contributing = generate_contributing()
|
||||
status = (
|
||||
"Generated"
|
||||
if write_if_changed(str(CONTRIBUTING_PATH), contributing)
|
||||
else "Unchanged"
|
||||
)
|
||||
print(f"{status} ./CONTRIBUTING.md")
|
||||
|
||||
def readme_files(readme: str) -> dict[Path, str]:
|
||||
"""README.md and CONTRIBUTING.md as the repository holds them."""
|
||||
return {
|
||||
Path(README_PATH): GENERATED_MARKER + readme,
|
||||
Path(CONTRIBUTING_PATH): GENERATED_MARKER + generate_contributing(),
|
||||
}
|
||||
|
||||
|
||||
def check_readme(readme: str) -> int:
|
||||
"""1, naming each file, when the committed text differs from the generated one."""
|
||||
stale = [path.name for path, text in readme_files(readme).items()
|
||||
if content_differs(str(path), text)]
|
||||
for name in stale:
|
||||
print(f"{name} differs from what generate_readme.py writes: run it and commit")
|
||||
return 1 if stale else 0
|
||||
|
||||
|
||||
def write_readme(readme: str) -> None:
|
||||
for path, text in readme_files(readme).items():
|
||||
status = "Generated" if write_if_changed(str(path), text) else "Unchanged"
|
||||
print(f"{status} ./{path.name}")
|
||||
@@ -64,7 +64,7 @@ def prime_system_icons(names: set[str]) -> int:
|
||||
"""Record which system icons the site holds a copy of, and return how
|
||||
many of ``names`` have none.
|
||||
|
||||
The icons are copied once into ``docs_assets/system-icons/`` by
|
||||
The icons are copied once into ``website/assets/system-icons/`` by
|
||||
``scripts/fetch_site_images.py``: the build reads that folder and never
|
||||
the network. A system without a copy gets no icon, because a heading
|
||||
with a broken image reads worse than a heading without one.
|
||||
|
||||
@@ -315,7 +315,7 @@ def og_section(rel: str, level: str) -> str:
|
||||
|
||||
# Sharing cards of their own, made by scripts/make_og_cards.py: one per
|
||||
# platform page, titled with the platform's name.
|
||||
OG_DIR = REPO_ROOT / "docs_assets" / "og"
|
||||
OG_DIR = REPO_ROOT / "website" / "assets" / "og"
|
||||
|
||||
|
||||
# An emulator page's card is that of the maker of the first system it runs,
|
||||
|
||||
@@ -86,7 +86,7 @@ STEPS: dict[str, tuple[str, tuple[Step, ...]]] = {
|
||||
)),
|
||||
}
|
||||
|
||||
# The recording each tab shows (docs_assets/demo/demo.json keys), "" for none.
|
||||
# The recording each tab shows (website/assets/demo/demo.json keys), "" for none.
|
||||
TAB_DEMOS = {"device": "handheld", "windows": ""}
|
||||
DEFAULT_DEMO = "default"
|
||||
|
||||
|
||||
Reference in new issue
Block a user