mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
rename plugins dirs
This commit is contained in:
parent
8713091e73
commit
e8f1264954
28 changed files with 31 additions and 31 deletions
|
@ -36,17 +36,17 @@ assert ARCHIVE_DIR == CONFIG.ARCHIVE_DIR
|
|||
|
||||
|
||||
def find_plugins_in_dir(plugins_dir: Path, prefix: str) -> Dict[str, Path]:
|
||||
"""{"pkg_plugins.pip": "/app/archivebox/pkg_plugins/pip", "user_plugins.other": "/data/user_plugins/other",...}"""
|
||||
"""{"plugins_pkg.pip": "/app/archivebox/plugins_pkg/pip", "user_plugins.other": "/data/user_plugins/other",...}"""
|
||||
return {
|
||||
f"{prefix}.{plugin_entrypoint.parent.name}": plugin_entrypoint.parent
|
||||
for plugin_entrypoint in sorted(plugins_dir.glob("*/apps.py")) # key=get_plugin_order # Someday enforcing plugin import order may be required, but right now it's not needed
|
||||
}
|
||||
|
||||
PLUGIN_DIRS = {
|
||||
'sys_plugins': PACKAGE_DIR / 'sys_plugins',
|
||||
'pkg_plugins': PACKAGE_DIR / 'pkg_plugins',
|
||||
'auth_plugins': PACKAGE_DIR / 'auth_plugins',
|
||||
'extractor_plugins': PACKAGE_DIR / 'extractor_plugins',
|
||||
'plugins_sys': PACKAGE_DIR / 'plugins_sys',
|
||||
'plugins_pkg': PACKAGE_DIR / 'plugins_pkg',
|
||||
'plugins_auth': PACKAGE_DIR / 'plugins_auth',
|
||||
'plugins_extractor': PACKAGE_DIR / 'plugins_extractor',
|
||||
'user_plugins': DATA_DIR / 'user_plugins',
|
||||
}
|
||||
INSTALLED_PLUGINS = {}
|
||||
|
@ -144,7 +144,7 @@ AUTHENTICATION_BACKENDS = [
|
|||
'django.contrib.auth.backends.ModelBackend',
|
||||
]
|
||||
|
||||
from ..auth_plugins.ldap.settings import LDAP_CONFIG
|
||||
from ..plugins_auth.ldap.settings import LDAP_CONFIG
|
||||
|
||||
if LDAP_CONFIG.LDAP_ENABLED:
|
||||
AUTH_LDAP_BIND_DN = LDAP_CONFIG.LDAP_BIND_DN
|
||||
|
@ -559,7 +559,7 @@ LOGGING = {
|
|||
"handlers": ["default", "logfile"],
|
||||
"level": "DEBUG",
|
||||
},
|
||||
"extractor_plugins": {
|
||||
"plugins_extractor": {
|
||||
"handlers": ["default", "logfile"],
|
||||
"level": "DEBUG",
|
||||
},
|
||||
|
|
|
@ -11,11 +11,11 @@ class BaseAdminDataView(BaseHook):
|
|||
|
||||
# verbose_name: str = 'Data View'
|
||||
# route: str = '/npm/installed/'
|
||||
# view: str = 'pkg_plugins.npm.admin.installed_list_view'
|
||||
# view: str = 'plugins_pkg.npm.admin.installed_list_view'
|
||||
# items: Dict[str, str] = {
|
||||
# "name": "installed_npm_pkg",
|
||||
# 'route': '<str:key>/',
|
||||
# 'view': 'pkg_plugins.npm.admin.installed_detail_view',
|
||||
# 'view': 'plugins_pkg.npm.admin.installed_detail_view',
|
||||
# }
|
||||
|
||||
def register(self, settings, parent_plugin=None):
|
||||
|
|
|
@ -26,11 +26,11 @@ class BaseHook(BaseModel):
|
|||
# django imports AppConfig, models, migrations, admins, etc. for all installed apps
|
||||
# django then calls AppConfig.ready() on each installed app...
|
||||
|
||||
pkg_plugins.npm.NpmPlugin().AppConfig.ready() # called by django
|
||||
pkg_plugins.npm.NpmPlugin().register(settings) ->
|
||||
pkg_plugins.npm.NpmConfigSet().register(settings)
|
||||
plugins_pkg.npm.NpmPlugin().AppConfig.ready() # called by django
|
||||
plugins_pkg.npm.NpmPlugin().register(settings) ->
|
||||
plugins_pkg.npm.NpmConfigSet().register(settings)
|
||||
plugantic.base_configset.BaseConfigSet().register(settings)
|
||||
plugantic.base_hook.BaseHook().register(settings, parent_plugin=pkg_plugins.npm.NpmPlugin())
|
||||
plugantic.base_hook.BaseHook().register(settings, parent_plugin=plugins_pkg.npm.NpmPlugin())
|
||||
|
||||
...
|
||||
...
|
||||
|
@ -74,17 +74,17 @@ class BaseHook(BaseModel):
|
|||
|
||||
@property
|
||||
def hook_module(self) -> str:
|
||||
"""e.g. extractor_plugins.singlefile.apps.SinglefileConfigSet"""
|
||||
"""e.g. plugins_extractor.singlefile.apps.SinglefileConfigSet"""
|
||||
return f'{self.__module__}.{self.__class__.__name__}'
|
||||
|
||||
@property
|
||||
def hook_file(self) -> Path:
|
||||
"""e.g. extractor_plugins.singlefile.apps.SinglefileConfigSet"""
|
||||
"""e.g. plugins_extractor.singlefile.apps.SinglefileConfigSet"""
|
||||
return Path(inspect.getfile(self.__class__))
|
||||
|
||||
@property
|
||||
def plugin_module(self) -> str:
|
||||
"""e.g. extractor_plugins.singlefile"""
|
||||
"""e.g. plugins_extractor.singlefile"""
|
||||
return f"{self.__module__}.{self.__class__.__name__}".split("archivebox.", 1)[-1].rsplit(".apps.", 1)[0]
|
||||
|
||||
@property
|
||||
|
|
|
@ -61,14 +61,14 @@ class BasePlugin(BaseModel):
|
|||
def plugin_module(self) -> str: # DottedImportPath
|
||||
""" "
|
||||
Dotted import path of the plugin's module (after its loaded via settings.INSTALLED_APPS).
|
||||
e.g. 'archivebox.pkg_plugins.npm.apps.NpmPlugin' -> 'pkg_plugins.npm'
|
||||
e.g. 'archivebox.plugins_pkg.npm.apps.NpmPlugin' -> 'plugins_pkg.npm'
|
||||
"""
|
||||
return f"{self.__module__}.{self.__class__.__name__}".split("archivebox.", 1)[-1].rsplit('.apps.', 1)[0]
|
||||
|
||||
|
||||
@property
|
||||
def plugin_module_full(self) -> str: # DottedImportPath
|
||||
"""e.g. 'archivebox.pkg_plugins.npm.apps.NpmPlugin'"""
|
||||
"""e.g. 'archivebox.plugins_pkg.npm.apps.NpmPlugin'"""
|
||||
return f"{self.__module__}.{self.__class__.__name__}"
|
||||
|
||||
# @computed_field
|
||||
|
@ -84,7 +84,7 @@ class BasePlugin(BaseModel):
|
|||
# preserve references to original default objects,
|
||||
# pydantic deepcopies them by default which breaks mutability
|
||||
# see https://github.com/pydantic/pydantic/issues/7608
|
||||
# if we dont do this, then sys_plugins.base.CORE_CONFIG != settings.CONFIGS.CoreConfig for example
|
||||
# if we dont do this, then plugins_sys.base.CORE_CONFIG != settings.CONFIGS.CoreConfig for example
|
||||
# and calling .__init__() on one of them will not update the other
|
||||
self.hooks = self.model_fields['hooks'].default
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
__package__ = 'archivebox.auth_plugins.ldap'
|
||||
__package__ = 'archivebox.plugins_auth.ldap'
|
||||
|
||||
import inspect
|
||||
|
||||
|
@ -14,7 +14,7 @@ from plugantic.base_plugin import BasePlugin
|
|||
from plugantic.base_hook import BaseHook
|
||||
from plugantic.base_binary import BaseBinary, BaseBinProvider
|
||||
|
||||
from pkg_plugins.pip.apps import SYS_PIP_BINPROVIDER, VENV_PIP_BINPROVIDER
|
||||
from plugins_pkg.pip.apps import SYS_PIP_BINPROVIDER, VENV_PIP_BINPROVIDER
|
||||
from .settings import LDAP_CONFIG, LDAP_LIB
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
__package__ = 'archivebox.auth_plugins.ldap'
|
||||
__package__ = 'archivebox.plugins_auth.ldap'
|
||||
|
||||
import sys
|
||||
|
|
@ -23,8 +23,8 @@ from plugantic.base_binary import BaseBinary, env
|
|||
from plugantic.base_hook import BaseHook
|
||||
|
||||
# Depends on Other Plugins:
|
||||
from pkg_plugins.puppeteer.apps import PUPPETEER_BINPROVIDER
|
||||
from pkg_plugins.playwright.apps import PLAYWRIGHT_BINPROVIDER
|
||||
from plugins_pkg.puppeteer.apps import PUPPETEER_BINPROVIDER
|
||||
from plugins_pkg.playwright.apps import PLAYWRIGHT_BINPROVIDER
|
||||
|
||||
|
||||
CHROMIUM_BINARY_NAMES_LINUX = [
|
|
@ -1,4 +1,4 @@
|
|||
__package__ = 'archivebox.extractor_plugins.singlefile'
|
||||
__package__ = 'archivebox.plugins_extractor.singlefile'
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List, Dict, Optional, ClassVar
|
||||
|
@ -19,8 +19,8 @@ from plugantic.base_queue import BaseQueue
|
|||
from plugantic.base_hook import BaseHook
|
||||
|
||||
# Depends on Other Plugins:
|
||||
from sys_plugins.base.apps import ARCHIVING_CONFIG
|
||||
from pkg_plugins.npm.apps import SYS_NPM_BINPROVIDER, LIB_NPM_BINPROVIDER
|
||||
from plugins_sys.base.apps import ARCHIVING_CONFIG
|
||||
from plugins_pkg.npm.apps import SYS_NPM_BINPROVIDER, LIB_NPM_BINPROVIDER
|
||||
|
||||
###################### Config ##########################
|
||||
|
|
@ -10,7 +10,7 @@ from plugantic.base_configset import BaseConfigSet, ConfigSectionName
|
|||
from plugantic.base_binary import BaseBinary, env, apt, brew
|
||||
from plugantic.base_hook import BaseHook
|
||||
|
||||
from pkg_plugins.pip.apps import pip
|
||||
from plugins_pkg.pip.apps import pip
|
||||
|
||||
###################### Config ##########################
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
__package__ = 'archivebox.pkg_plugins.npm'
|
||||
__package__ = 'archivebox.plugins_pkg.npm'
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
|
@ -27,7 +27,7 @@ from plugantic.base_binary import BaseBinary, BaseBinProvider, env
|
|||
# from plugantic.base_queue import BaseQueue
|
||||
from plugantic.base_hook import BaseHook
|
||||
|
||||
from pkg_plugins.pip.apps import SYS_PIP_BINPROVIDER, VENV_PIP_BINPROVIDER, LIB_PIP_BINPROVIDER
|
||||
from plugins_pkg.pip.apps import SYS_PIP_BINPROVIDER, VENV_PIP_BINPROVIDER, LIB_PIP_BINPROVIDER
|
||||
|
||||
|
||||
###################### Config ##########################
|
|
@ -25,7 +25,7 @@ from plugantic.base_binary import BaseBinary, BaseBinProvider, env
|
|||
from plugantic.base_hook import BaseHook
|
||||
|
||||
# Depends on Other Plugins:
|
||||
from pkg_plugins.npm.apps import LIB_NPM_BINPROVIDER, SYS_NPM_BINPROVIDER
|
||||
from plugins_pkg.npm.apps import LIB_NPM_BINPROVIDER, SYS_NPM_BINPROVIDER
|
||||
|
||||
|
||||
###################### Config ##########################
|
Loading…
Add table
Add a link
Reference in a new issue