flag if plugin was packaged

This commit is contained in:
Matthias 2021-11-04 12:42:22 +01:00
parent e12e93f19e
commit 50e5bfc4a4
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -830,6 +830,7 @@ for plugin in PLUGIN_DIRS:
# Get plugins from setup entry points # Get plugins from setup entry points
for entry in metadata.entry_points().get('inventree_plugins', []): for entry in metadata.entry_points().get('inventree_plugins', []):
plugin = entry.load() plugin = entry.load()
plugin.is_package = True
PLUGINS.append(plugin) PLUGINS.append(plugin)
# collect integration plugins # collect integration plugins
@ -838,5 +839,12 @@ INTEGRATION_PLUGIN_SETTING = {}
INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet
for plugin in inventree_plugins.load_integration_plugins(): for plugin in inventree_plugins.load_integration_plugins():
# check if package
was_packaged = getattr(plugin, 'is_package', False)
# init package
plugin.is_package = was_packaged
plugin = plugin() plugin = plugin()
plugin.is_package = was_packaged
# safe reference
INTEGRATION_PLUGINS[plugin.slug] = plugin INTEGRATION_PLUGINS[plugin.slug] = plugin