resolve packages for legacy plugins

Updated legacy plugin loader to handle pakcages if the PLUGINS entry
contains `.`. Also adds a test for it.
This commit is contained in:
Deniz Turgut 2020-10-12 14:50:42 +03:00
commit 991c00af95
No known key found for this signature in database
GPG key ID: 87B7168D7AB3ED2F
6 changed files with 30 additions and 0 deletions

View file

@ -40,6 +40,11 @@ def list_plugins(ns_pkg=None):
def load_legacy_plugin(plugin, plugin_paths):
if '.' in plugin:
# it is in a package, try to resolve package first
package, _, _ = plugin.rpartition('.')
load_legacy_plugin(package, plugin_paths)
# Try to find plugin in PLUGIN_PATHS
spec = importlib.machinery.PathFinder.find_spec(plugin, plugin_paths)
if spec is None: