mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
parent
83d0693013
commit
93a28bbaba
@ -19,6 +19,7 @@ import string
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import importlib
|
import importlib
|
||||||
|
from importlib import metadata
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import moneyed
|
import moneyed
|
||||||
@ -821,6 +822,11 @@ for plugin in PLUGIN_DIRS:
|
|||||||
if modules:
|
if modules:
|
||||||
[PLUGINS.append(item) for item in modules]
|
[PLUGINS.append(item) for item in modules]
|
||||||
|
|
||||||
|
# Get plugins from setup entry points
|
||||||
|
for entry in metadata.entry_points().get('inventree_plugins', []):
|
||||||
|
plugin = entry.load()
|
||||||
|
PLUGINS.append(plugin)
|
||||||
|
|
||||||
# collect integration plugins
|
# collect integration plugins
|
||||||
INTEGRATION_PLUGINS = {}
|
INTEGRATION_PLUGINS = {}
|
||||||
INTEGRATION_PLUGIN_SETTING = {}
|
INTEGRATION_PLUGIN_SETTING = {}
|
||||||
|
@ -34,7 +34,12 @@ class PluginConfig(AppConfig):
|
|||||||
# add them to the INSTALLED_APPS
|
# add them to the INSTALLED_APPS
|
||||||
for slug, plugin in plugins:
|
for slug, plugin in plugins:
|
||||||
if plugin.mixin_enabled('app'):
|
if plugin.mixin_enabled('app'):
|
||||||
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(settings.BASE_DIR).parts)
|
try:
|
||||||
|
# for local path plugins
|
||||||
|
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(settings.BASE_DIR).parts)
|
||||||
|
except ValueError:
|
||||||
|
# plugin is shipped as package
|
||||||
|
plugin_path = plugin.PLUGIN_NAME
|
||||||
if plugin_path not in settings.INSTALLED_APPS:
|
if plugin_path not in settings.INSTALLED_APPS:
|
||||||
settings.INSTALLED_APPS += [plugin_path]
|
settings.INSTALLED_APPS += [plugin_path]
|
||||||
apps_changed = True
|
apps_changed = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user