mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
parent
7a6686f467
commit
991c00af95
6 changed files with 30 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue