支持以软件包的方式导入插件

This commit is contained in:
洛水居室 2022-07-27 00:18:10 +08:00
parent 45dc8f9df7
commit d76fdc8a73
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -34,6 +34,10 @@ class PluginsManager:
for plugin_path in plugin_paths: for plugin_path in plugin_paths:
if plugin_path.startswith('__'): if plugin_path.startswith('__'):
continue continue
if os.path.isdir(plugin_path):
plugin_path = os.path.basename(plugin_path)
self.plugin_list.append(plugin_path)
continue
module_name = path.basename(path.normpath(plugin_path)) module_name = path.basename(path.normpath(plugin_path))
root, ext = os.path.splitext(module_name) root, ext = os.path.splitext(module_name)
if ext == ".py": if ext == ".py":