Removes custom plugins directory

- rely on plugins.txt instead
This commit is contained in:
Oliver 2022-01-06 13:31:04 +11:00
parent 75d5f9d6e6
commit 836b6275b6
3 changed files with 17 additions and 31 deletions

View File

@ -934,23 +934,6 @@ if DEBUG or TESTING:
# load samples in debug mode # load samples in debug mode
PLUGIN_DIRS.append('plugin.samples') PLUGIN_DIRS.append('plugin.samples')
# Check if an external plugin directory has been specified as an environment variable
# Note: This should be specified as INVENTREE_PLUGIN_DIR
plugin_dir = os.getenv('INVENTREE_PLUGIN_DIR')
if plugin_dir:
if not os.path.exists(plugin_dir):
logger.info(f"Plugin directory '{plugin_dir}' does not exist")
try:
os.makedirs(plugin_dir, exist_ok=True)
logger.info(f"Created plugin directory '{plugin_dir}'")
except:
logger.warning(f"Could not create plugins directory '{plugin_dir}'")
if os.path.exists(plugin_dir):
PLUGIN_DIRS.append(plugin_dir)
# Plugin test settings # Plugin test settings
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested? PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested?
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing? PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing?

View File

@ -34,7 +34,7 @@ ENV INVENTREE_PLUGIN_DIR="${INVENTREE_DATA_DIR}/plugins"
ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml" ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml"
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt" ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DATA_DIR}/secret_key.txt"
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DATA_DIR}}/plugins.txt" ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DATA_DIR}/plugins.txt"
# Worker configuration (can be altered by user) # Worker configuration (can be altered by user)
ENV INVENTREE_GUNICORN_WORKERS="4" ENV INVENTREE_GUNICORN_WORKERS="4"
@ -131,8 +131,12 @@ ENV INVENTREE_PY_ENV="${INVENTREE_DEV_DIR}/env"
# Override default path settings # Override default path settings
ENV INVENTREE_STATIC_ROOT="${INVENTREE_DEV_DIR}/static" ENV INVENTREE_STATIC_ROOT="${INVENTREE_DEV_DIR}/static"
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DEV_DIR}/media" ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DEV_DIR}/media"
ENV INVENTREE_PLUGIN_DIR="${INVENTREE_DEV_DIR}/plugins"
ENV INVENTREE_CONFIG_FILE="${INVENTREE_DEV_DIR}/config.yaml" ENV INVENTREE_CONFIG_FILE="${INVENTREE_DEV_DIR}/config.yaml"
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DEV_DIR}/secret_key.txt" ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DEV_DIR}/secret_key.txt"
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DEV_DIR}/plugins.txt"
WORKDIR ${INVENTREE_HOME} WORKDIR ${INVENTREE_HOME}

View File

@ -71,19 +71,6 @@ def manage(c, cmd, pty=False):
cmd=cmd cmd=cmd
), pty=pty) ), pty=pty)
@task
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 @task
def plugins(c): def plugins(c):
""" """
@ -99,12 +86,24 @@ def plugins(c):
if not os.path.exists(PLUGIN_FILE): if not os.path.exists(PLUGIN_FILE):
# Create an empty plugin # Create an empty plugin
print(f"Plugins file '{PLUGIN_FILE}' does not exist") print(f"Plugins file '{PLUGIN_FILE}' does not exist")
return
print(f"Installing plugin packages from '{PLUGIN_FILE}'") print(f"Installing plugin packages from '{PLUGIN_FILE}'")
# Install the plugins # Install the plugins
c.run(f"pip3 install -U -r '{PLUGIN_FILE}'") c.run(f"pip3 install -U -r '{PLUGIN_FILE}'")
@task(post=[plugins])
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 @task
def shell(c): def shell(c):
""" """