|
@@ -13,9 +13,9 @@ __package__ = 'archivebox'
|
|
|
|
|
|
|
|
import os
|
|
import os
|
|
|
import sys
|
|
import sys
|
|
|
-
|
|
|
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
|
from typing import cast
|
|
from typing import cast
|
|
|
|
|
+
|
|
|
ASCII_LOGO = """
|
|
ASCII_LOGO = """
|
|
|
█████╗ ██████╗ ██████╗██╗ ██╗██╗██╗ ██╗███████╗ ██████╗ ██████╗ ██╗ ██╗
|
|
█████╗ ██████╗ ██████╗██╗ ██╗██╗██╗ ██╗███████╗ ██████╗ ██████╗ ██╗ ██╗
|
|
|
██╔══██╗██╔══██╗██╔════╝██║ ██║██║██║ ██║██╔════╝ ██╔══██╗██╔═══██╗╚██╗██╔╝
|
|
██╔══██╗██╔══██╗██╔════╝██║ ██║██║██║ ██║██╔════╝ ██╔══██╗██╔═══██╗╚██╗██╔╝
|
|
@@ -51,14 +51,13 @@ from .vendor import load_vendored_libs # noqa
|
|
|
load_vendored_libs()
|
|
load_vendored_libs()
|
|
|
# print('DONE LOADING VENDORED LIBRARIES')
|
|
# print('DONE LOADING VENDORED LIBRARIES')
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+# Load ABX Plugin Specifications + Default Implementations
|
|
|
import abx # noqa
|
|
import abx # noqa
|
|
|
import abx_spec_archivebox # noqa
|
|
import abx_spec_archivebox # noqa
|
|
|
-import abx_spec_config # noqa
|
|
|
|
|
|
|
+import abx_spec_config # noqa
|
|
|
import abx_spec_pydantic_pkgr # noqa
|
|
import abx_spec_pydantic_pkgr # noqa
|
|
|
-import abx_spec_django # noqa
|
|
|
|
|
-import abx_spec_searchbackend # noqa
|
|
|
|
|
-
|
|
|
|
|
|
|
+import abx_spec_django # noqa
|
|
|
|
|
+import abx_spec_searchbackend # noqa
|
|
|
|
|
|
|
|
abx.pm.add_hookspecs(abx_spec_config.PLUGIN_SPEC)
|
|
abx.pm.add_hookspecs(abx_spec_config.PLUGIN_SPEC)
|
|
|
abx.pm.register(abx_spec_config.PLUGIN_SPEC())
|
|
abx.pm.register(abx_spec_config.PLUGIN_SPEC())
|
|
@@ -72,30 +71,30 @@ abx.pm.register(abx_spec_django.PLUGIN_SPEC())
|
|
|
abx.pm.add_hookspecs(abx_spec_searchbackend.PLUGIN_SPEC)
|
|
abx.pm.add_hookspecs(abx_spec_searchbackend.PLUGIN_SPEC)
|
|
|
abx.pm.register(abx_spec_searchbackend.PLUGIN_SPEC())
|
|
abx.pm.register(abx_spec_searchbackend.PLUGIN_SPEC())
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+# Cast to ArchiveBoxPluginSpec to enable static type checking of pm.hook.call() methods
|
|
|
abx.pm = cast(abx.ABXPluginManager[abx_spec_archivebox.ArchiveBoxPluginSpec], abx.pm)
|
|
abx.pm = cast(abx.ABXPluginManager[abx_spec_archivebox.ArchiveBoxPluginSpec], abx.pm)
|
|
|
pm = abx.pm
|
|
pm = abx.pm
|
|
|
|
|
|
|
|
|
|
|
|
|
-# Load all installed ABX-compatible plugins
|
|
|
|
|
|
|
+# Load all pip-installed ABX-compatible plugins
|
|
|
ABX_ECOSYSTEM_PLUGINS = abx.get_pip_installed_plugins(group='abx')
|
|
ABX_ECOSYSTEM_PLUGINS = abx.get_pip_installed_plugins(group='abx')
|
|
|
-# Load all ArchiveBox-specific plugins
|
|
|
|
|
|
|
+
|
|
|
|
|
+# Load all built-in ArchiveBox plugins
|
|
|
ARCHIVEBOX_BUILTIN_PLUGINS = {
|
|
ARCHIVEBOX_BUILTIN_PLUGINS = {
|
|
|
'config': PACKAGE_DIR / 'config',
|
|
'config': PACKAGE_DIR / 'config',
|
|
|
'core': PACKAGE_DIR / 'core',
|
|
'core': PACKAGE_DIR / 'core',
|
|
|
# 'search': PACKAGE_DIR / 'search',
|
|
# 'search': PACKAGE_DIR / 'search',
|
|
|
# 'core': PACKAGE_DIR / 'core',
|
|
# 'core': PACKAGE_DIR / 'core',
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
# Load all user-defined ArchiveBox plugins
|
|
# Load all user-defined ArchiveBox plugins
|
|
|
USER_PLUGINS = abx.find_plugins_in_dir(Path(os.getcwd()) / 'user_plugins')
|
|
USER_PLUGINS = abx.find_plugins_in_dir(Path(os.getcwd()) / 'user_plugins')
|
|
|
-# Merge all plugins together
|
|
|
|
|
-ALL_PLUGINS = {**ABX_ECOSYSTEM_PLUGINS, **ARCHIVEBOX_BUILTIN_PLUGINS, **USER_PLUGINS}
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
-# Load ArchiveBox plugins
|
|
|
|
|
|
|
+# Import all plugins and register them with ABX Plugin Manager
|
|
|
|
|
+ALL_PLUGINS = {**ABX_ECOSYSTEM_PLUGINS, **ARCHIVEBOX_BUILTIN_PLUGINS, **USER_PLUGINS}
|
|
|
LOADED_PLUGINS = abx.load_plugins(ALL_PLUGINS)
|
|
LOADED_PLUGINS = abx.load_plugins(ALL_PLUGINS)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+# Setup basic config, constants, paths, and version
|
|
|
from .config.constants import CONSTANTS # noqa
|
|
from .config.constants import CONSTANTS # noqa
|
|
|
from .config.paths import PACKAGE_DIR, DATA_DIR, ARCHIVE_DIR # noqa
|
|
from .config.paths import PACKAGE_DIR, DATA_DIR, ARCHIVE_DIR # noqa
|
|
|
from .config.version import VERSION # noqa
|
|
from .config.version import VERSION # noqa
|