diff options
Diffstat (limited to 'backend/plugin.py')
| -rw-r--r-- | backend/plugin.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/backend/plugin.py b/backend/plugin.py index efaeb322..dea35299 100644 --- a/backend/plugin.py +++ b/backend/plugin.py @@ -9,7 +9,7 @@ from logging import getLogger from traceback import format_exc from os import path, setgid, setuid, environ from signal import SIGINT, signal -from sys import exit +from sys import exit, path as syspath from time import time import helpers from updater import Updater @@ -66,6 +66,7 @@ class PluginWrapper: environ["USER"] = "root" if "root" in self.flags else helpers.get_user() environ["DECKY_VERSION"] = helpers.get_loader_version() environ["DECKY_USER"] = helpers.get_user() + environ["DECKY_USER_HOME"] = helpers.get_home_path() environ["DECKY_HOME"] = helpers.get_homebrew_path() environ["DECKY_PLUGIN_SETTINGS_DIR"] = path.join(environ["DECKY_HOME"], "settings", self.plugin_directory) helpers.mkdir_as_user(environ["DECKY_PLUGIN_SETTINGS_DIR"]) @@ -77,11 +78,19 @@ class PluginWrapper: environ["DECKY_PLUGIN_NAME"] = self.name environ["DECKY_PLUGIN_VERSION"] = self.version environ["DECKY_PLUGIN_AUTHOR"] = self.author + # append the loader's plugin path to the recognized python paths + syspath.append(path.realpath(path.join(path.dirname(__file__), "plugin"))) + # append the plugin's `py_modules` to the recognized python paths + syspath.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules")) + # append the system and user python paths + syspath.extend(helpers.get_system_pythonpaths()) spec = spec_from_file_location("_", self.file) module = module_from_spec(spec) spec.loader.exec_module(module) self.Plugin = module.Plugin + if hasattr(self.Plugin, "_migration"): + get_event_loop().run_until_complete(self.Plugin._migration(self.Plugin)) if hasattr(self.Plugin, "_main"): get_event_loop().create_task(self.Plugin._main(self.Plugin)) get_event_loop().create_task(self._setup_socket()) |
