mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 02:27:52 -06:00
refactor: site code reads the repo root from core
This commit is contained in:
1 parent
d50dfc36e2
commit
ab0265408c
13 files changed
+31
-23
No files matched your search
@@ -39,6 +39,7 @@ from resolve.review import LARGE_FILE_ISSUE_URL
|
||||
from model.largefiles import LARGE_FILES_CACHE, load_registered_paths
|
||||
import pr_checks
|
||||
from packs.coverage import verify_platform
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
|
||||
def _installer_words() -> ModuleType:
|
||||
@@ -46,7 +47,7 @@ def _installer_words() -> ModuleType:
|
||||
README named a line menu the one-liner never opens."""
|
||||
import importlib.util
|
||||
|
||||
path = Path(__file__).resolve().parent.parent / "install.py"
|
||||
path = REPO_ROOT / "install.py"
|
||||
spec = importlib.util.spec_from_file_location("install", path)
|
||||
if spec is None or spec.loader is None:
|
||||
raise ImportError(f"cannot load {path}")
|
||||
@@ -57,7 +58,7 @@ def _installer_words() -> ModuleType:
|
||||
|
||||
# The repository's profiles wherever the script is run from: a bare
|
||||
# "emulators" read the working directory, and a run elsewhere counted 0 cores.
|
||||
_EMULATORS_DIR = str(Path(__file__).resolve().parent.parent / "emulators")
|
||||
_EMULATORS_DIR = str(REPO_ROOT / "emulators")
|
||||
|
||||
|
||||
def compute_coverage(
|
||||
@@ -132,7 +133,7 @@ def compute_coverage(
|
||||
}
|
||||
|
||||
|
||||
_REPO = Path(__file__).resolve().parent.parent
|
||||
_REPO = REPO_ROOT
|
||||
# The site and the README read the same coverage: the first generator to run
|
||||
# stores it here and the second reads it back, instead of verifying every
|
||||
# platform twice (about a minute of the site build).
|
||||
@@ -451,7 +452,7 @@ def format_size(size: int) -> str:
|
||||
|
||||
SITE_URL = "https://abdess.github.io/retrobios/"
|
||||
# The installer demo (scripts/make_demo.py): the recording and what it shows.
|
||||
DEMO_DIR = Path(__file__).resolve().parent.parent / "docs_assets" / "demo"
|
||||
DEMO_DIR = REPO_ROOT / "docs_assets" / "demo"
|
||||
DEMO_GIF = "docs_assets/demo/install.gif"
|
||||
REPO_PATH = "../.."
|
||||
REPO = "Abdess/retrobios"
|
||||
|
||||
@@ -169,6 +169,7 @@ from siterender import (
|
||||
_icon_name,
|
||||
prime_system_icons,
|
||||
)
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
yaml = require_yaml()
|
||||
|
||||
@@ -3547,7 +3548,7 @@ PLATFORM_REFERENCE_BUDGET = 600
|
||||
# gaps-files-to-source-7.md -> gaps.md. When a budget or a list changes, a
|
||||
# part can fold back or the list shrink, and its address then redirects to
|
||||
# that page instead of ending on the 404 page.
|
||||
PUBLISHED_PARTS_FILE = (Path(__file__).resolve().parent.parent
|
||||
PUBLISHED_PARTS_FILE = (REPO_ROOT
|
||||
/ "website" / "src" / "data" / "published-parts.json")
|
||||
|
||||
|
||||
@@ -5010,7 +5011,7 @@ def generate_files_page() -> str:
|
||||
])
|
||||
|
||||
|
||||
_REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
_REPO_ROOT = REPO_ROOT
|
||||
|
||||
|
||||
def data_directory_members(install_dir: Path = _REPO_ROOT / "install") -> dict[str, dict[str, dict]]:
|
||||
@@ -12444,7 +12445,7 @@ def _build_file_consumers(db: dict, coverages: dict, profiles: dict) -> FileCons
|
||||
consumers = FileConsumers(db, build_zip_contents_index(db))
|
||||
consumers.add_platforms({name: cov["config"] for name, cov in coverages.items()})
|
||||
consumers.add_emulators(profiles)
|
||||
consumers.add_manifests(Path(__file__).resolve().parent.parent / "install")
|
||||
consumers.add_manifests(REPO_ROOT / "install")
|
||||
return consumers
|
||||
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ from core.github import github_token
|
||||
from model.database import load_database
|
||||
from model.profiles import load_emulator_profiles
|
||||
from core.cli import run_cli
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
CONFIG = Path(os.environ.get("RETROBIOS_CONFIG", Path.home() / ".config" / "retrobios"))
|
||||
SITE_PROPERTY = "https://abdess.github.io/retrobios/"
|
||||
GOATCOUNTER = "https://retrobios.goatcounter.com/api/v0"
|
||||
|
||||
@@ -40,6 +40,7 @@ from typing import ClassVar
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from core.cli import run_cli
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
SITE = "https://abdess.github.io"
|
||||
BASE = "/retrobios/"
|
||||
@@ -400,7 +401,7 @@ def page_markdown(html: str, page_url: str) -> str:
|
||||
return converter.markdown()
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
ROOT = REPO_ROOT
|
||||
|
||||
|
||||
def build_stamp() -> dict[str, str]:
|
||||
|
||||
@@ -9,11 +9,8 @@ bios folder comes from siteinputs, never the working directory.
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import os
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
import siteinputs
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
from model.profiles import load_emulator_profiles
|
||||
|
||||
@@ -43,8 +43,9 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import siteinputs
|
||||
import sitemarkup as markup
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
ROOT = REPO_ROOT
|
||||
|
||||
PLACEHOLDER = re.compile(r"(?m)^([ \t]*)<!--\s*image:\s*([A-Za-z0-9_-]+)\s*-->[ \t]*$")
|
||||
PLACEHOLDER_ANYWHERE = re.compile(r"<!--\s*image:\s*([A-Za-z0-9_-]+)\s*-->")
|
||||
|
||||
@@ -19,8 +19,9 @@ from pathlib import Path
|
||||
import sitemarkup as markup
|
||||
from model.safeparse import require_yaml
|
||||
from sitebootstrap import PS1_NAME, SH_NAME
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
PLATFORMS_DIR = Path(__file__).resolve().parent.parent / "platforms"
|
||||
PLATFORMS_DIR = REPO_ROOT / "platforms"
|
||||
GUIDES_FILE = PLATFORMS_DIR / "_guides.yml"
|
||||
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ from pathlib import Path
|
||||
import sitemarkup as 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
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
# Below the site's root: get/handheld/RetroBIOS.zip.
|
||||
SERVED_DIR = "get/handheld"
|
||||
# The page of the systems no registered platform answers for. It shares
|
||||
|
||||
@@ -11,7 +11,9 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
ROOT = REPO_ROOT
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
@@ -35,8 +35,9 @@ import measurement_records as mr
|
||||
import sitemarkup as markup
|
||||
from core.artifacts import json_text, write_if_changed
|
||||
from siterender import _escape_tags
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
ROOT = REPO_ROOT
|
||||
REPO = "https://github.com/Abdess/retrobios"
|
||||
EXPLORER_PAGE = "measurements.md"
|
||||
METHOD_PAGE = "wiki/measurements.md"
|
||||
|
||||
@@ -5,16 +5,16 @@ from __future__ import annotations
|
||||
import re
|
||||
import urllib.parse
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
import siteinputs
|
||||
import sitemarkup as markup
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
|
||||
WIKI_SRC_DIR = "wiki" # manually maintained wiki sources
|
||||
SYSTEM_ICON_BASE = "https://raw.githubusercontent.com/libretro/retroarch-assets/master/xmb/systematic/png"
|
||||
# Local copies of the upstream icons, named as upstream names them.
|
||||
ICON_DIR = Path(__file__).resolve().parent.parent / "docs_assets" / "system-icons"
|
||||
ICON_DIR = REPO_ROOT / "docs_assets" / "system-icons"
|
||||
|
||||
# Icon names the site holds a copy of. A name mapped to False has none.
|
||||
_icon_available: dict[str, bool] = {}
|
||||
@@ -793,7 +793,7 @@ def set_console_sections(
|
||||
|
||||
|
||||
_sections_installed = [False]
|
||||
_REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
_REPO_ROOT = REPO_ROOT
|
||||
|
||||
|
||||
def _ensure_console_sections() -> None:
|
||||
|
||||
@@ -26,6 +26,7 @@ from model.sourceref import (
|
||||
source_ref_values,
|
||||
split_source_ref,
|
||||
)
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
|
||||
def _repo_pins(profile: dict, field: str, label: str) -> list[tuple[str, str, str]]:
|
||||
@@ -167,8 +168,8 @@ def _source_permalink(repo: upstream.Repo, pin: str, path: str,
|
||||
# writes SOURCE_PATHS. The pages read that file: the deploy has no tree
|
||||
# cache, and a citation it could not check was linked into whichever
|
||||
# repository the profile declared, 30 of them to a 404.
|
||||
TREE_CACHE = Path(__file__).resolve().parent.parent / upstream.CACHE_DIR
|
||||
SOURCE_PATHS = (Path(__file__).resolve().parent.parent
|
||||
TREE_CACHE = REPO_ROOT / upstream.CACHE_DIR
|
||||
SOURCE_PATHS = (REPO_ROOT
|
||||
/ "website" / "src" / "data" / "source-paths.json")
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ from dataclasses import dataclass, field
|
||||
from html import unescape
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
BASE = "/retrobios/"
|
||||
SITE_URL = "https://abdess.github.io/retrobios/"
|
||||
|
||||
@@ -336,7 +338,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 = Path(__file__).resolve().parent.parent / "docs_assets" / "og"
|
||||
OG_DIR = REPO_ROOT / "docs_assets" / "og"
|
||||
|
||||
|
||||
# An emulator page's card is that of the maker of the first system it runs,
|
||||
|
||||
Reference in new issue
Block a user