mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 10:23:16 -05:00
fix: a platform's own data trees leave its pack
The platform layer names data trees for its systems: retroarch.yml carries dolphin-sys and ppsspp-assets, and Lakka inherits them, while Lakka's core packages install both trees into the system directory. A profile records that with installed_on on its data directory, and the pack and the install manifest now leave those trees out for that platform.
This commit is contained in:
1 parent
4227aee9b4
commit
6df087e3e9
3 files changed
+40
No files matched your search
@@ -1779,6 +1779,24 @@ def source_yaml_paths(directory: str | Path) -> list[Path]:
|
||||
]
|
||||
|
||||
|
||||
def installed_data_refs(platform: str, emulators_dir: str = "") -> frozenset[str]:
|
||||
"""Data directories a platform's own packages install beside the cores.
|
||||
|
||||
The platform layer names trees for its systems (retroarch.yml carries
|
||||
dolphin-sys and ppsspp-assets, and Lakka inherits them), while Lakka's
|
||||
core packages put both into the system directory themselves. A profile
|
||||
records that with installed_on on its data directory reference.
|
||||
"""
|
||||
emulators_dir = emulators_dir or os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "emulators")
|
||||
return frozenset(
|
||||
str(tree.get("ref", ""))
|
||||
for profile in load_emulator_profiles(emulators_dir, skip_aliases=False).values()
|
||||
for tree in profile.get("data_directories") or []
|
||||
if isinstance(tree, dict) and platform in (tree.get("installed_on") or [])
|
||||
)
|
||||
|
||||
|
||||
def load_emulator_profiles(
|
||||
emulators_dir: str,
|
||||
skip_aliases: bool = True,
|
||||
|
||||
@@ -33,6 +33,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from common import resolve_platform_cores as _platform_cores
|
||||
from common import (
|
||||
installed_data_refs,
|
||||
platform_arg,
|
||||
require_directory,
|
||||
target_listing_line,
|
||||
@@ -400,6 +401,8 @@ def _data_directory_members(
|
||||
ref_key = dd.get("ref", "")
|
||||
if not ref_key or not data_registry or ref_key not in data_registry:
|
||||
continue
|
||||
if ref_key in installed_data_refs(platform_name):
|
||||
continue
|
||||
entry = data_registry[ref_key]
|
||||
allowed = entry.get("for_platforms")
|
||||
if allowed and platform_name not in allowed:
|
||||
|
||||
@@ -4625,6 +4625,25 @@ class BundledFilesAreNotToSource(unittest.TestCase):
|
||||
})
|
||||
self.assertEqual(unknown, [])
|
||||
|
||||
def test_a_tree_the_platform_installs_leaves_its_pack(self):
|
||||
"""retroarch.yml names dolphin-sys and ppsspp-assets and Lakka
|
||||
inherits them, while Lakka's core packages install both trees."""
|
||||
import tempfile
|
||||
|
||||
import yaml as _yaml
|
||||
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
import common
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
Path(tmp, "dolphin.yml").write_text(_yaml.safe_dump({
|
||||
"emulator": "Dolphin", "type": "libretro", "files": [],
|
||||
"data_directories": [{"ref": "dolphin-sys", "installed_on": ["lakka"]}]}))
|
||||
self.assertEqual(common.installed_data_refs("lakka", tmp), frozenset({"dolphin-sys"}))
|
||||
self.assertEqual(common.installed_data_refs("retroarch", tmp), frozenset())
|
||||
source = (ROOT / "scripts" / "generate_pack.py").read_text(encoding="utf-8")
|
||||
self.assertIn("if ref_key in installed_data_refs(platform_name):", source)
|
||||
|
||||
def test_the_pack_builder_skips_it(self):
|
||||
source = (ROOT / "scripts" / "packextras.py").read_text(encoding="utf-8")
|
||||
self.assertIn('if u.get("bundled"):', source)
|
||||
|
||||
Reference in new issue
Block a user