Files
nixpkgs/pkgs/by-name/re/renpy/temp-compile-modules.patch
2026-05-17 14:14:23 -07:00

37 lines
1.1 KiB
Diff

diff --git a/renpy/exports/__init__.py b/renpy/exports/__init__.py
index f95c8d0ad..e312c99c5 100644
--- a/renpy/exports/__init__.py
+++ b/renpy/exports/__init__.py
@@ -578,6 +578,7 @@ from renpy.exports.scriptexports import (
load_language as load_language,
load_module as load_module,
load_string as load_string,
+ loaded_modules as loaded_modules,
munged_filename as munged_filename,
)
diff --git a/renpy/main.py b/renpy/main.py
index 60940a595..ed53e3072 100644
--- a/renpy/main.py
+++ b/renpy/main.py
@@ -423,6 +423,19 @@ def main():
print(time.time() - start)
sys.exit(0)
+ import re
+ pattern = re.compile(r"^(.*)\.rpym$")
+ for fn in renpy.exports.list_files(common=True):
+ m = pattern.match(fn)
+ if m:
+ name = m.group(1)
+ if name in renpy.exports.loaded_modules:
+ print("Module {} already loaded".format(name))
+ else:
+ print("Compiling module {}".format(name))
+ renpy.game.script.load_module(name)
+ sys.exit(0)
+
renpy.game.exception_info = "After loading the script."
# Find the save directory.