mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-03 23:08:55 -06:00
fix: settle a platform declaration in one place
The pack builder and the manifest each coded the copy a declaration ships: resolve, agnostic substitute, frontend verdict, then the cores' choice. The builder skipped the cores' choice once an earlier declaration of the path was refused, and shipped the copy the name found while the installer placed the variant the core accepts. DeclarationJudge in packs/declsettle.py now settles it for both, and the cores choose on every copy shipped.
This commit is contained in:
1 parent
d2f4ef6f9c
commit
5b3f0c3f4c
8 files changed
+248
-158
No files matched your search
@@ -85,16 +85,22 @@ class ValidatedChoice(unittest.TestCase):
|
||||
|
||||
def test_pack_and_manifest_both_read_it(self):
|
||||
tree = ast.parse(script_source("generate_pack.py"))
|
||||
callers = {
|
||||
node.name
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, ast.FunctionDef)
|
||||
and any(
|
||||
isinstance(call, ast.Call) and getattr(call.func, "id", None) == "validated_choice"
|
||||
for call in ast.walk(node)
|
||||
)
|
||||
}
|
||||
self.assertLessEqual({"build_platform_pack", "generate_manifest"}, callers)
|
||||
|
||||
def callers_of(name: str) -> set[str]:
|
||||
return {
|
||||
node.name
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, ast.FunctionDef)
|
||||
and any(
|
||||
isinstance(call, ast.Call) and getattr(call.func, "id", None) == name
|
||||
for call in ast.walk(node)
|
||||
)
|
||||
}
|
||||
|
||||
# A platform declaration is settled by one judge, which reads it on
|
||||
# every copy shipped.
|
||||
self.assertLessEqual({"build_platform_pack", "generate_manifest"}, callers_of("DeclarationJudge"))
|
||||
self.assertIn("settle", callers_of("validated_choice"))
|
||||
# The manifest's core extras go through the builder's own lookup,
|
||||
# which reads validated_choice (packextras.ExtraResolver).
|
||||
resolvers = {
|
||||
@@ -125,11 +131,11 @@ class ValidatedChoice(unittest.TestCase):
|
||||
node for node in ast.walk(tree)
|
||||
if isinstance(node, ast.FunctionDef) and node.name == "build_platform_pack"
|
||||
)
|
||||
calls = [
|
||||
call for call in ast.walk(builder)
|
||||
if isinstance(call, ast.Call) and getattr(call.func, "id", None) == "validated_choice"
|
||||
]
|
||||
self.assertGreaterEqual(len(calls), 1)
|
||||
# The baseline goes through the judge the manifest reads too.
|
||||
self.assertTrue(any(
|
||||
isinstance(call, ast.Call) and getattr(call.func, "id", None) == "DeclarationJudge"
|
||||
for call in ast.walk(builder)
|
||||
))
|
||||
# The core extras go through the lookup verify shares, which judges.
|
||||
self.assertTrue(any(
|
||||
isinstance(call, ast.Call) and getattr(call.func, "attr", None) == "resolve"
|
||||
|
||||
Reference in new issue
Block a user