summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2020-04-12 16:43:53 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2020-04-12 16:43:53 +0200
commita72152c462fafac8a0be57801b0835caf443cb8d (patch)
tree20ea4073c00e3e4c3ca2b9a350a97db873c26075
parent8585ef18eb0f32dd1fd1fea122f33b3ae63cc062 (diff)
downloadpoezio-a72152c462fafac8a0be57801b0835caf443cb8d.tar.gz
poezio-a72152c462fafac8a0be57801b0835caf443cb8d.tar.bz2
poezio-a72152c462fafac8a0be57801b0835caf443cb8d.tar.xz
poezio-a72152c462fafac8a0be57801b0835caf443cb8d.zip
plugins: Add refs to dependencies on plugins
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/plugin.py4
-rw-r--r--poezio/plugin_manager.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/poezio/plugin.py b/poezio/plugin.py
index 81c849b4..0ba13412 100644
--- a/poezio/plugin.py
+++ b/poezio/plugin.py
@@ -4,7 +4,7 @@ These are used in the plugin system added in poezio 0.7.5
(see plugin_manager.py)
"""
-from typing import Set
+from typing import Any, Dict, Set
from asyncio import iscoroutinefunction
from functools import partial
from configparser import RawConfigParser
@@ -406,6 +406,8 @@ class BasePlugin(object, metaclass=SafetyMetaclass):
default_config = None
dependencies: Set[str] = set()
+ # This dict will get populated when the plugin is initialized
+ refs: Dict[str, Any] = {}
def __init__(self, name, plugin_api, core, plugins_conf_dir):
self.__name = name
diff --git a/poezio/plugin_manager.py b/poezio/plugin_manager.py
index 874d0dc9..bf708089 100644
--- a/poezio/plugin_manager.py
+++ b/poezio/plugin_manager.py
@@ -136,6 +136,8 @@ class PluginManager:
name, dep
)
return None
+ # Add reference of the dep to the plugin's usage
+ module.Plugin.refs[dep] = self.plugins[dep]
self.plugins[name] = module.Plugin(name, self.plugin_api, self.core,
self.plugins_conf_dir)