mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 19:38:52 -06:00
refactor: place every file through Placed
data_directory_members, pack_data_tree and manifest_core_entries take the Placed record instead of three loose sets and a fold flag, and verify's replay of the builder (_builder_placement), hidden_extras and the emulator pack check keep a Placed of their own. hidden_extras records the sha1 at each taken path through the new Placed content option, which keeps its same-content case twin rule. No behavior change.
This commit is contained in:
1 parent
899f591575
commit
ca3ff1d4c5
15 files changed
+62
-97
No files matched your search
@@ -7109,6 +7109,7 @@ class RequiredOnlyReachesDataDirectories(unittest.TestCase):
|
||||
|
||||
def _members(self, required_only: bool) -> list[str]:
|
||||
from scripts.packs import datatrees
|
||||
from scripts.packs.archive import Placed
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
for key in ("needed", "optional"):
|
||||
@@ -7129,7 +7130,7 @@ class RequiredOnlyReachesDataDirectories(unittest.TestCase):
|
||||
return [
|
||||
dest
|
||||
for _src, dest in datatrees.data_directory_members(
|
||||
systems, registry, "retroarch", "", False, set(), set(), set(),
|
||||
systems, registry, "retroarch", "", Placed(False),
|
||||
required_only=required_only,
|
||||
)
|
||||
]
|
||||
|
||||
@@ -177,7 +177,7 @@ class AmberelecCarriesTheMachines(unittest.TestCase):
|
||||
members = dict(
|
||||
(full, src) for src, full in datatrees.data_directory_members(
|
||||
config.get("systems", {}), registry, "amberelec",
|
||||
config.get("base_destination", ""), False, set(), set(), set(),
|
||||
config.get("base_destination", ""), archive.Placed(False),
|
||||
refs_out=refs, core_trees=trees,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -42,9 +42,11 @@ class OneRule(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_builder_and_report_read_it(self):
|
||||
self.assertIn("placement_block(", script_source("packs/archive.py"))
|
||||
for module in ("generate_pack.py", "packs/extras.py"):
|
||||
source = script_source(module)
|
||||
self.assertIn("placement_block(", source, module)
|
||||
self.assertIn("Placed(", source, module)
|
||||
self.assertIn(".block(", source, module)
|
||||
builder = script_source("generate_pack.py")
|
||||
self.assertNotIn("if full_dest.lower() in seen_lower and case_insensitive", builder)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from packs import manifestcores
|
||||
from packs.archive import Placed
|
||||
from packs import manifestentry
|
||||
from packs.manifestselect import SelectionIndex
|
||||
|
||||
@@ -69,8 +70,7 @@ class AnEntryWithoutSourceIsAnOmission(unittest.TestCase):
|
||||
manifestcores.manifest_core_entries(
|
||||
[extra], {}, self.db, str(REPO_ROOT / "bios"), "", str(REPO_ROOT),
|
||||
{}, True,
|
||||
region_drops=set(), case_insensitive=False, seen_destinations=set(),
|
||||
seen_lower=set(), seen_parents=set(), manifest_files=files,
|
||||
region_drops=set(), placed=Placed(False), manifest_files=files,
|
||||
omitted_by_destination={}, record_omission=record,
|
||||
pack_only_sizes=pack_only, selection=SelectionIndex.build({}, {}, {}, []),
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ from unittest import mock
|
||||
import refresh_data_dirs as rdd
|
||||
from packs import datadirs
|
||||
from model.registry import load_versions
|
||||
from packs.archive import Placed
|
||||
from packs.datatrees import data_directory_members
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -203,7 +204,7 @@ class PackWalkHoldsTheCache(unittest.TestCase):
|
||||
(cache / "b.mkf").write_bytes(b"b")
|
||||
systems = {"s": {"data_directories": [{"ref": "sdlpal", "destination": "sdlpal"}]}}
|
||||
registry = {"sdlpal": {"local_cache": str(cache)}}
|
||||
walk = data_directory_members(systems, registry, "p", "", False, set(), set(), set())
|
||||
walk = data_directory_members(systems, registry, "p", "", Placed(False))
|
||||
next(walk)
|
||||
with open(cache.with_name(".sdlpal.lock"), "a") as handle, self.assertRaises(
|
||||
BlockingIOError
|
||||
@@ -237,7 +238,7 @@ class EmulatorPackHoldsTheCache(unittest.TestCase):
|
||||
held.append(False)
|
||||
|
||||
with mock.patch("packs.datatrees.add_pack_member", member):
|
||||
pack_data_tree(None, str(cache), "scummvm", set(), set(), set())
|
||||
pack_data_tree(None, str(cache), "scummvm", Placed(True))
|
||||
self.assertEqual(held, [True])
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user