mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 02:27:52 -06:00
refactor: recipe modules read the repo root
This commit is contained in:
1 parent
5f7cbdc582
commit
664776ae91
3 files changed
+7
-8
No files matched your search
@@ -34,7 +34,6 @@ import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable
|
||||
@@ -43,12 +42,10 @@ from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import BinaryIO
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
from core.torrentzip import Source as Readable
|
||||
from core.paths import REPO_ROOT
|
||||
from core.torrentzip import write_torrentzip, zlib_ng_version
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
ARCHIVES_FILE = REPO_ROOT / "recipes" / "archives.json"
|
||||
# The writer contract: build_torrentzip's layout over stock zlib. A change to
|
||||
# the layout is a new builder name and a new proof of every record.
|
||||
|
||||
@@ -31,6 +31,7 @@ from model.dumpcatalog import DEFAULT_PROVENANCE_DIR, load_provenance_snapshots
|
||||
from model.database import load_database
|
||||
from model.profiles import load_emulator_profiles
|
||||
from core.artifacts import write_if_changed
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
HASH_FIELDS = ("sha1", "md5", "sha256")
|
||||
|
||||
@@ -202,7 +203,7 @@ def _held_in_archive(entry: dict, members: dict) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
RECIPES_DIR = Path(__file__).resolve().parent.parent / "recipes"
|
||||
RECIPES_DIR = REPO_ROOT / "recipes"
|
||||
|
||||
|
||||
def romset_index(recipes_dir: Path = RECIPES_DIR) -> dict[tuple[str, int], list[dict]]:
|
||||
|
||||
@@ -53,13 +53,14 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
from core.cli import require_directory
|
||||
from core.paths import REPO_ROOT
|
||||
from model.database import load_database
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import list_registered_platforms
|
||||
from core.torrentzip import build_torrentzip, is_torrentzip
|
||||
|
||||
ARCHIVES_FILE = Path(__file__).resolve().parent.parent / "recipes" / "archives.json"
|
||||
ARCHIVES_FILE = REPO_ROOT / "recipes" / "archives.json"
|
||||
|
||||
Recipe = list[tuple[str, str]]
|
||||
|
||||
@@ -228,11 +229,11 @@ class AtomPool:
|
||||
return self._built[key]
|
||||
|
||||
|
||||
DIGEST_CACHE = Path(__file__).resolve().parent.parent / ".cache" / "romset_digests.json"
|
||||
DIGEST_CACHE = REPO_ROOT / ".cache" / "romset_digests.json"
|
||||
# The writer's own source is part of every key: a change to how TorrentZip
|
||||
# bytes are laid out invalidates every digest it produced.
|
||||
_WRITER = hashlib.sha256(
|
||||
(Path(__file__).resolve().parent / "core" / "torrentzip.py").read_bytes()
|
||||
(REPO_ROOT / "scripts" / "core" / "torrentzip.py").read_bytes()
|
||||
).hexdigest()[:16]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user