mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 19:08:51 -06:00
refactor: read retropie module fields in one place
rp_registerModule sources the script: the id, section, flags and repo are top-level assignments, the last one wins. The platform, target, launcher, rom folder and export readers each kept their own pattern; they now share module_fields. Same ids and flags over the 287 scriptmodules at 427e7621.
This commit is contained in:
1 parent
24463647f6
commit
12b00e024b
6 files changed
+40
-39
No files matched your search
@@ -33,7 +33,7 @@ from collections.abc import Iterator
|
||||
|
||||
from model.safeparse import parse_untrusted_xml, yaml_load_upstream
|
||||
|
||||
from ..retropie_modules import PLATFORM_FLAGS, module_enabled
|
||||
from ..retropie_modules import PLATFORM_FLAGS, module_enabled, module_fields
|
||||
from . import Fetcher, SourceError, register
|
||||
|
||||
|
||||
@@ -917,7 +917,6 @@ def recalbox(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
# RetroPie
|
||||
|
||||
|
||||
_MODULE_FIELD = re.compile(r'^rp_module_(id|section|flags)="([^"]*)"', re.MULTILINE)
|
||||
_ADD_EMULATOR = re.compile(r'^\s*addEmulator\s+(\S+)\s+("[^"]*"|\S+)\s+("[^"]*"|\S+)')
|
||||
_LIST = re.compile(r'(?:local\s+)?(\w+)=\(([^)]*)\)')
|
||||
_LOOP = re.compile(r'for (\w+) in (.+?); do')
|
||||
@@ -979,7 +978,7 @@ def retropie(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
if not path.endswith(".sh") or path.count("/") != 2:
|
||||
continue
|
||||
text = fetcher.text(key, path)
|
||||
fields = dict(_MODULE_FIELD.findall(text))
|
||||
fields = module_fields(text)
|
||||
if not module_enabled(fields.get("flags", "").split(), platform):
|
||||
continue
|
||||
modules.append({"path": path, "id": fields.get("id", ""),
|
||||
|
||||
Reference in new issue
Block a user