Skip to content

Commit

Permalink
sandboxed_plugin: a slightly less hacky fix for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
K900 committed Nov 13, 2023
1 parent 9da453f commit aa2dfa8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/decky_loader/plugin/sandboxed_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from os import path, environ
from pathlib import Path
from signal import SIGINT, signal
from importlib.util import module_from_spec, spec_from_file_location
from json import dumps, loads
Expand Down Expand Up @@ -73,10 +74,9 @@ def initialize(self, socket: LocalSocket):
# append the plugin's `py_modules` to the recognized python paths
syspath.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules"))

# Hack to make plugins able to import Decky internals without the decky_loader prefix
#TODO: FIX IN A LESS CURSED WAY
keys = [key.replace("decky_loader.", "") for key in sysmodules if key.startswith("decky_loader.")]
for key in keys:
sysmodules[key] = sysmodules["decky_loader"].__dict__[key]
syspath.append(str(Path(__file__).parent.parent))

spec = spec_from_file_location("_", self.file)
assert spec is not None
Expand Down

0 comments on commit aa2dfa8

Please sign in to comment.