Files
libretro/scripts/model/profilekinds.py
T
Abdessamad Derraz 71776198e9 refactor: move profile kinds to their own module
model.systems kept an inline copy of reads_own_files because model.profiles imports it. The predicates live in model.profilekinds, which both import, and model.profiles re-exports them. sitegen.build reads lists_files instead of its own launcher/alias tuple.
2026-11-21 10:29:37 +01:00

24 lines
901 B
Python

"""What kind of profile a profile is: an emulator, an alias, a launcher, a test core."""
from __future__ import annotations
# A launcher hands the game to another emulator and an alias is another
# profile's build under a second name: neither declares files of its own.
FILELESS_TYPES = frozenset({"launcher", "alias"})
def lists_files(profile: dict) -> bool:
"""Whether a profile declares the files its emulator reads."""
return profile.get("type") not in FILELESS_TYPES
def is_emulator(profile: dict) -> bool:
"""Whether a profile counts as an emulator of its own, neither an alias
nor a test core."""
return profile.get("type") != "alias" and profile.get("role") != "test"
def reads_own_files(profile: dict) -> bool:
"""Whether a profile lists the files its emulator reads and is not a test core."""
return lists_files(profile) and profile.get("role") != "test"