2019-10-26 14:03:51 +08:00
|
|
|
import importlib.util
|
2019-10-26 12:49:50 +08:00
|
|
|
from pluginbase import PluginBase, PluginSource
|
|
|
|
|
|
|
|
|
|
|
|
class MiPluginSource(PluginSource):
|
|
|
|
def load_plugin(self, name):
|
2019-10-26 14:03:51 +08:00
|
|
|
plugin = super().load_plugin(name)
|
|
|
|
spec = importlib.util.spec_from_file_location(self.base.package + '.' + name, plugin.__file__)
|
|
|
|
plugin = importlib.util.module_from_spec(spec)
|
|
|
|
spec.loader.exec_module(plugin)
|
|
|
|
return plugin
|
2019-10-26 12:49:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
class MiPluginBase(PluginBase):
|
|
|
|
def make_plugin_source(self, *args, **kwargs):
|
|
|
|
return MiPluginSource(self, *args, **kwargs)
|