2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Add invoke target to install plugins from file

This commit is contained in:
Oliver
2022-01-06 12:25:07 +11:00
parent e0e6dbac94
commit 5c2121b1a1
3 changed files with 39 additions and 7 deletions

View File

@ -78,10 +78,33 @@ def install(c):
Installs required python packages
"""
print("Installing required python packages from 'requirements.txt'")
# Install required Python packages with PIP
c.run('pip3 install -U -r requirements.txt')
@task
def plugins(c):
"""
Installs all plugins as specified in 'plugins.txt'
"""
try:
from InvenTree.InvenTree.settings import PLUGIN_FILE
except:
print("Error: Could not import PLUGIN_FILE from settings.py")
return
if not os.path.exists(PLUGIN_FILE):
# Create an empty plugin
print(f"Plugins file '{PLUGIN_FILE}' does not exist")
print(f"Installing plugin packages from '{PLUGIN_FILE}'")
# Install the plugins
c.run(f"pip3 install -U -r '{PLUGIN_FILE}'")
@task
def shell(c):
"""