mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-30 21:38:55 -06:00
refactor: load install.py as a module in one place
The event schema, the installer doc, the launcher index, the site and the README each executed install.py with their own importlib block. installer_build.module.installer_module is cached and read by all five.
This commit is contained in:
1 parent
fb17242a78
commit
ccd440f67a
7 files changed
+33
-50
No files matched your search
@@ -7,7 +7,6 @@ import html
|
||||
import json
|
||||
import re
|
||||
import shlex
|
||||
import types
|
||||
from collections import Counter
|
||||
|
||||
from model import siteinputs
|
||||
@@ -19,6 +18,7 @@ from resolve.layout import runs_standalone, standalone_layout_path
|
||||
from resolve.standalone import standalone_set
|
||||
from sitegen import markup
|
||||
from core.paths import REPO_ROOT
|
||||
from installer_build.module import installer_module
|
||||
from sitegen.fields import search_excluded
|
||||
from sitegen.guides import fence, platform_args, terminal_tabs
|
||||
from sitegen.render import code_span, escape_tags
|
||||
@@ -88,20 +88,6 @@ def install_commands(args: str = "", indent: str = "",
|
||||
return lines
|
||||
|
||||
|
||||
@functools.cache
|
||||
def installer_module() -> types.ModuleType:
|
||||
"""install.py, read as a module: the names `--emulator` accepts are its
|
||||
own (`emulator_names`)."""
|
||||
import importlib.util
|
||||
|
||||
spec = importlib.util.spec_from_file_location("install", REPO_ROOT / "install.py")
|
||||
if spec is None or spec.loader is None:
|
||||
raise ImportError(f"cannot load {REPO_ROOT / 'install.py'}")
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
@functools.cache
|
||||
def _published_emulator_names() -> dict[str, dict[str, str]]:
|
||||
"""Per published manifest, every name `--emulator` accepts there and the
|
||||
|
||||
Reference in new issue
Block a user