summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-03-26 00:33:55 +0100
committerMaxime Buquet <pep@bouah.net>2020-03-26 00:33:55 +0100
commit2101439e8693e3be233e59280b0386f0622c756e (patch)
treebc95e12b772d906ee5cf5a5111b56bacdff68424
parentb2e6d29c4ce8b380cf988b6007da81b687972402 (diff)
parentdae4aeb3bb789b7af47c3137476543366c96314b (diff)
downloadpoezio-2101439e8693e3be233e59280b0386f0622c756e.tar.gz
poezio-2101439e8693e3be233e59280b0386f0622c756e.tar.bz2
poezio-2101439e8693e3be233e59280b0386f0622c756e.tar.xz
poezio-2101439e8693e3be233e59280b0386f0622c756e.zip
Merge branch 'plugin-debug' into 'master'
Plugin debug See merge request poezio/poezio!70
-rw-r--r--plugins/reorder.py14
-rw-r--r--poezio/plugin_manager.py10
2 files changed, 19 insertions, 5 deletions
diff --git a/plugins/reorder.py b/plugins/reorder.py
index 32fa6639..8d9516f8 100644
--- a/plugins/reorder.py
+++ b/plugins/reorder.py
@@ -117,6 +117,8 @@ def parse_runtime_tablist(tablist):
class Plugin(BasePlugin):
+ """reorder plugin"""
+
def init(self):
self.api.add_command(
'reorder',
@@ -129,20 +131,24 @@ class Plugin(BasePlugin):
help='Save the current tab layout')
@command_args_parser.ignored
- def command_save_order(self):
+ def command_save_order(self) -> None:
+ """
+ /save_order
+ """
conf = parse_runtime_tablist(self.core.tabs)
for key, value in conf:
self.config.set(key, value)
self.api.information('Tab order saved', 'Info')
@command_args_parser.ignored
- def command_reorder(self):
+ def command_reorder(self) -> None:
"""
/reorder
"""
tabs_spec = parse_config(self.config)
if not tabs_spec:
- return self.api.information('Invalid reorder config', 'Error')
+ self.api.information('Invalid reorder config', 'Error')
+ return None
old_tabs = self.core.tabs.get_tabs()
roster = old_tabs.pop(0)
@@ -173,3 +179,5 @@ class Plugin(BasePlugin):
self.core.tabs.replace_tabs(new_tabs)
self.core.refresh_window()
+
+ return None
diff --git a/poezio/plugin_manager.py b/poezio/plugin_manager.py
index 58cfb3d3..e603b6fa 100644
--- a/poezio/plugin_manager.py
+++ b/poezio/plugin_manager.py
@@ -69,7 +69,10 @@ class PluginManager:
module = None
loader = self.finder.find_module(name, self.load_path)
if loader:
+ log.debug('Found candidate loader for plugin %s: %r', name, loader)
module = loader.load_module()
+ if module is None:
+ log.debug('Failed to load plugin %s from loader', name)
else:
try:
module = import_module('poezio_plugins.%s' % name)
@@ -77,16 +80,19 @@ class PluginManager:
pass
for entry in pkg_resources.iter_entry_points('poezio_plugins'):
if entry.name == name:
+ log.debug('Found candidate entry for plugin %s: %r', name, entry)
try:
module = entry.load()
- except ImportError:
- pass
+ except ImportError as exn:
+ log.debug('Failed to import plugin: %s\n%r', name,
+ exn, exc_info=True)
finally:
break
if not module:
self.core.information('Could not find plugin: %s' % name,
'Error')
return
+ log.debug('Plugin %s loaded from "%s"', name, module.__file__)
except Exception as e:
log.debug("Could not load plugin %s", name, exc_info=True)
self.core.information("Could not load plugin %s: %s" % (name, e),