diff --git a/scripts/check_freshness.py b/scripts/check_freshness.py index ff6b5823..2a67030c 100644 --- a/scripts/check_freshness.py +++ b/scripts/check_freshness.py @@ -1057,7 +1057,7 @@ def main() -> int: parser.add_argument("--profiles", action="store_true", help="also run profile_sync (slow)") parser.add_argument("--offline", action="store_true", help="no network, local ages only") parser.add_argument("--jobs", type=int, default=4, help="parallel scrapers") - parser.add_argument("--cache-dir", default=".cache/upstream") + parser.add_argument("--cache-dir", default=upstream.CACHE_DIR) parser.add_argument("--native-cache-dir", default=export_native.DEFAULT_CACHE) parser.add_argument("--truth-dir", default="dist/truth") parser.add_argument("--platforms-dir", default="platforms") diff --git a/scripts/mame_ref_audit.py b/scripts/mame_ref_audit.py index 1e5b2efb..5f1b6111 100644 --- a/scripts/mame_ref_audit.py +++ b/scripts/mame_ref_audit.py @@ -115,7 +115,7 @@ def main() -> None: parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument("emulators", nargs="+") parser.add_argument("--emulators-dir", default="emulators") - parser.add_argument("--cache-dir", default=".cache") + parser.add_argument("--cache-dir", default=upstream.CACHE_DIR) parser.add_argument("--offline", action="store_true") parser.add_argument("--write", action="store_true") args = parser.parse_args() diff --git a/scripts/profile_sync.py b/scripts/profile_sync.py index b5a87274..652505be 100644 --- a/scripts/profile_sync.py +++ b/scripts/profile_sync.py @@ -31,7 +31,7 @@ import upstream from common import load_emulator_profiles from upstream import CompareResult, find_renamed -DEFAULT_CACHE = ".cache/upstream" +DEFAULT_CACHE = upstream.CACHE_DIR ANON_QUOTA = 60 TRIAGE_PATH_SAMPLE = 5 diff --git a/scripts/upstream.py b/scripts/upstream.py index 5142fca9..985925d5 100644 --- a/scripts/upstream.py +++ b/scripts/upstream.py @@ -21,6 +21,8 @@ from dataclasses import dataclass from pathlib import Path USER_AGENT = "retrobios-profile-sync/1.0" +# Where fetched upstream files live, shared by every reader of this cache. +CACHE_DIR = ".cache/upstream" ABSENT = "\0absent\0" GITHUB_COMPARE_CAP = 300 RETRIES = 3 diff --git a/tests/test_mame_ref_audit.py b/tests/test_mame_ref_audit.py index cbba5dbd..6f560dc2 100644 --- a/tests/test_mame_ref_audit.py +++ b/tests/test_mame_ref_audit.py @@ -112,12 +112,13 @@ class TestCorpusStaysCorrect(unittest.TestCase): """ def test_every_mame_family_ref_names_its_own_set(self): - if not (ROOT / ".cache").is_dir(): + cache = ROOT / mame_ref_audit.upstream.CACHE_DIR + if not cache.is_dir(): self.skipTest("no upstream cache") for name in ("mame", "mamearcade", "mamemess", "groovymame"): with self.subTest(emulator=name): findings, agreed, _ = mame_ref_audit.audit( - name, str(ROOT / "emulators"), str(ROOT / ".cache"), True + name, str(ROOT / "emulators"), str(cache), True ) if not agreed and not findings: self.skipTest(f"{name}: driver sources not cached")