forked from abrignoni/RLEAPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook-plugin_loader.py
More file actions
executable file
·24 lines (16 loc) · 916 Bytes
/
hook-plugin_loader.py
File metadata and controls
executable file
·24 lines (16 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import plugin_loader
# Hey PyInstaller? Yeah you! Take a look at these plugins! I know they're not actually imported anywhere but you
# better believe that they will be a runtime, so, if you wouldn't mind, it'd be fantastic if you pretended that
# they're imported normally and pick up *their* imports. OK? Great. Fantastic.
print("Hooking plugins for pyinstaller")
loader = plugin_loader.PluginLoader()
tmp = []
for py_file in plugin_loader.PLUGINPATH.glob("*.py"):
mod = plugin_loader.PluginLoader.load_module_lazy(py_file)
try:
mod_artifacts = mod.__artifacts__
except AttributeError:
pass # any unconverted plugins still get checked out so they don't break the loader during runtime
tmp.append("scripts.artifacts." + mod.__name__) # TODO this is a hack, if we ever move plugins this breaks
print(f"{len(tmp)} plugins loaded as hidden imports")
hiddenimports = list(tmp)