mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
add type hints to plugin config models
This commit is contained in:
parent
97b185987d
commit
777694eb1a
4 changed files with 36 additions and 31 deletions
|
@ -42,20 +42,20 @@ class ArchiveBoxBaseDependency(models.Model):
|
|||
LABEL = "Default"
|
||||
REQUIRED = False
|
||||
|
||||
PARENT_DEPENDENCIES = []
|
||||
PARENT_DEPENDENCIES: List[str] = []
|
||||
|
||||
BIN_DEPENDENCIES = []
|
||||
APT_DEPENDENCIES = []
|
||||
BREW_DEPENDENCIES = []
|
||||
PIP_DEPENDENCIES = []
|
||||
NPM_DEPENDENCIES = []
|
||||
BIN_DEPENDENCIES: List[str] = []
|
||||
APT_DEPENDENCIES: List[str] = []
|
||||
BREW_DEPENDENCIES: List[str] = []
|
||||
PIP_DEPENDENCIES: List[str] = []
|
||||
NPM_DEPENDENCIES: List[str] = []
|
||||
|
||||
DEFAULT_BINARY = '/bin/bash'
|
||||
DEFAULT_START_CMD = '/bin/bash -c "while true; do sleep 1; done"'
|
||||
DEFAULT_PID_FILE = 'logs/{NAME}_WORKER.pid'
|
||||
DEFAULT_STOP_CMD = 'kill "$(<{PID_FILE})"'
|
||||
DEFAULT_VERSION_COMMAND = '{BINARY} --version'
|
||||
DEFAULT_ARGS = ''
|
||||
DEFAULT_BINARY: str | None = '/bin/bash'
|
||||
DEFAULT_START_CMD: str | None = '/bin/bash -c "while true; do sleep 1; done"'
|
||||
DEFAULT_PID_FILE: str | None = 'logs/{NAME}_WORKER.pid'
|
||||
DEFAULT_STOP_CMD: str | None = 'kill "$(<{PID_FILE})"'
|
||||
DEFAULT_VERSION_COMMAND: str | None = '{BINARY} --version'
|
||||
DEFAULT_ARGS: str | None = ''
|
||||
|
||||
VERSION_CMD = '{BINARY} --version'
|
||||
|
||||
|
@ -136,7 +136,8 @@ class ArchiveBoxBaseDependency(models.Model):
|
|||
# @helper
|
||||
def install_parents(self, config):
|
||||
return {
|
||||
parent_dependency.NAME: parent_dependency.get_solo().install_self()
|
||||
# parent_dependency.NAME: parent_dependency.get_solo().install_self()
|
||||
parent_dependency: parent_dependency
|
||||
for parent_dependency in self.PARENT_DEPENDENCIES
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ReplayWebPageConfig(AppConfig):
|
||||
label = "ReplayWeb.Page"
|
||||
name = "plugin_replaywebpage"
|
||||
class GalleryDLAppConfig(AppConfig):
|
||||
label = "Gallery-DL"
|
||||
name = "plugin_gallerydl"
|
||||
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
|
||||
def ready(self):
|
||||
# querying models is ok, but don't fetch rows from DB or perform stateful actions here
|
||||
|
||||
print('√ Loaded GalleryDL Plugin')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# __package__ = 'archivebox.plugins.system'
|
||||
__package__ = 'archivebox.plugins.system'
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
@ -6,7 +6,6 @@ from django.apps import AppConfig
|
|||
|
||||
class SystemPluginAppConfig(AppConfig):
|
||||
name = "plugins.system"
|
||||
# label = "ArchiveBox System"
|
||||
verbose_name = "Host System Configuration"
|
||||
|
||||
default_auto_field = "django.db.models.AutoField"
|
||||
|
|
|
@ -34,11 +34,11 @@ class BashEnvironmentDependency(ArchiveBoxBaseDependency):
|
|||
|
||||
PARENT_DEPENDENCIES = []
|
||||
|
||||
BIN_DEPENDENCIES = ['bash']
|
||||
APT_DEPENDENCIES = []
|
||||
BREW_DEPENDENCIES = []
|
||||
PIP_DEPENDENCIES = []
|
||||
NPM_DEPENDENCIES = []
|
||||
BIN_DEPENDENCIES: List[str] = ['bash']
|
||||
APT_DEPENDENCIES: List[str] = []
|
||||
BREW_DEPENDENCIES: List[str] = []
|
||||
PIP_DEPENDENCIES: List[str] = []
|
||||
NPM_DEPENDENCIES: List[str] = []
|
||||
|
||||
DEFAULT_BINARY = 'bash'
|
||||
DEFAULT_START_CMD = None
|
||||
|
@ -152,7 +152,7 @@ class AptEnvironmentDependency(ArchiveBoxBaseDependency, SingletonModel):
|
|||
LABEL = "apt"
|
||||
REQUIRED = False
|
||||
|
||||
PARENT_DEPENDENCIES = [BashEnvironmentDependency]
|
||||
PARENT_DEPENDENCIES = ['BashEnvironmentDependency']
|
||||
|
||||
BIN_DEPENDENCIES = ['apt-get']
|
||||
APT_DEPENDENCIES = []
|
||||
|
@ -196,7 +196,7 @@ class BrewEnvironmentDependency(ArchiveBoxBaseDependency, SingletonModel):
|
|||
LABEL = "homebrew"
|
||||
REQUIRED = False
|
||||
|
||||
PARENT_DEPENDENCIES = [BashEnvironmentDependency]
|
||||
PARENT_DEPENDENCIES = ['BashEnvironmentDependency']
|
||||
|
||||
BIN_DEPENDENCIES = ['brew']
|
||||
APT_DEPENDENCIES = []
|
||||
|
@ -242,7 +242,7 @@ class PipEnvironmentDependency(ArchiveBoxBaseDependency, SingletonModel):
|
|||
LABEL = "pip"
|
||||
REQUIRED = False
|
||||
|
||||
PARENT_DEPENDENCIES = [BashEnvironmentDependency]
|
||||
PARENT_DEPENDENCIES = ['BashEnvironmentDependency']
|
||||
|
||||
BIN_DEPENDENCIES = ['python3', 'pip3']
|
||||
APT_DEPENDENCIES = ['python3.11', 'pip3', 'pipx']
|
||||
|
@ -285,7 +285,7 @@ class NPMEnvironmentDependency(ArchiveBoxBaseDependency, SingletonModel):
|
|||
LABEL = "NodeJS"
|
||||
REQUIRED = False
|
||||
|
||||
PARENT_DEPENDENCIES = [BashEnvironmentDependency]
|
||||
PARENT_DEPENDENCIES = ['BashEnvironmentDependency']
|
||||
|
||||
BIN_DEPENDENCIES = ['node', 'npm']
|
||||
APT_DEPENDENCIES = ['node', 'npm']
|
||||
|
@ -412,9 +412,9 @@ class ArchiveBoxDependency(ArchiveBoxBaseDependency):
|
|||
REQUIRED = True
|
||||
|
||||
PARENT_DEPENDENCIES = [
|
||||
PipEnvironmentDependency,
|
||||
DjangoDependency,
|
||||
SQLiteDependency,
|
||||
'PipEnvironmentDependency',
|
||||
'DjangoDependency',
|
||||
'SQLiteDependency',
|
||||
]
|
||||
|
||||
BIN_DEPENDENCIES = ['archivebox']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue