mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 22:54:27 -04:00
rename pkgs app to pkg
Some checks failed
Build Docker image / buildx (push) Has been cancelled
Build Homebrew package / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
Some checks failed
Build Docker image / buildx (push) Has been cancelled
Build Homebrew package / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
This commit is contained in:
parent
6e13cd4820
commit
da76a84c45
13 changed files with 80 additions and 5 deletions
|
@ -17,7 +17,7 @@ from plugantic.extractors import Extractor, ExtractorName
|
||||||
from plugantic.plugins import Plugin
|
from plugantic.plugins import Plugin
|
||||||
from plugantic.configs import ConfigSet, ConfigSectionName
|
from plugantic.configs import ConfigSet, ConfigSectionName
|
||||||
|
|
||||||
from pkgs.settings import env
|
from pkg.settings import env
|
||||||
|
|
||||||
|
|
||||||
###################### Config ##########################
|
###################### Config ##########################
|
||||||
|
|
|
@ -66,7 +66,7 @@ INSTALLED_APPS = [
|
||||||
'plugantic',
|
'plugantic',
|
||||||
'core',
|
'core',
|
||||||
'api',
|
'api',
|
||||||
'pkgs',
|
'pkg',
|
||||||
|
|
||||||
*INSTALLED_PLUGINS.keys(),
|
*INSTALLED_PLUGINS.keys(),
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
__package__ = 'archivebox.pkgs'
|
__package__ = 'archivebox.pkg'
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class PkgsConfig(AppConfig):
|
class PkgsConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'pkgs'
|
name = 'pkg'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
from .settings import LOADED_DEPENDENCIES
|
from .settings import LOADED_DEPENDENCIES
|
0
archivebox/pkg/management/commands/__init__.py
Normal file
0
archivebox/pkg/management/commands/__init__.py
Normal file
75
archivebox/pkg/management/commands/pkg.py
Normal file
75
archivebox/pkg/management/commands/pkg.py
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
__package__ = 'archivebox.pkg.management.commands'
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from pydantic_pkgr import Binary, BinProvider, BrewProvider, EnvProvider, SemVer
|
||||||
|
from pydantic_pkgr.binprovider import bin_abspath
|
||||||
|
|
||||||
|
from ....config import NODE_BIN_PATH, bin_path
|
||||||
|
|
||||||
|
from plugantic.plugins import LOADED_PLUGINS
|
||||||
|
|
||||||
|
from pkg.settings import env
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
def handle(self, *args, method, **options):
|
||||||
|
method(*args, **options)
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
subparsers = parser.add_subparsers(title="sub-commands", required=True)
|
||||||
|
|
||||||
|
list_parser = subparsers.add_parser("list", help="List archivebox runtime dependencies.")
|
||||||
|
list_parser.set_defaults(method=self.list)
|
||||||
|
|
||||||
|
install_parser = subparsers.add_parser("install", help="Install archivebox runtime dependencies.")
|
||||||
|
install_parser.add_argument("--update", action="store_true", help="Update dependencies to latest versions.")
|
||||||
|
install_parser.add_argument("package_names", nargs="+", type=str)
|
||||||
|
install_parser.set_defaults(method=self.install)
|
||||||
|
|
||||||
|
def list(self, *args, **options):
|
||||||
|
self.stdout.write('################# PLUGINS ####################')
|
||||||
|
for plugin in LOADED_PLUGINS:
|
||||||
|
self.stdout.write(f'{plugin.name}:')
|
||||||
|
for binary in plugin.binaries:
|
||||||
|
try:
|
||||||
|
binary = binary.install()
|
||||||
|
except Exception as e:
|
||||||
|
# import ipdb; ipdb.set_trace()
|
||||||
|
raise
|
||||||
|
self.stdout.write(f' {binary.name.ljust(14)} {str(binary.version).ljust(11)} {binary.binprovider.INSTALLER_BIN.ljust(5)} {binary.abspath}')
|
||||||
|
|
||||||
|
self.stdout.write('\n################# LEGACY ####################')
|
||||||
|
for bin_key, dependency in settings.CONFIG.DEPENDENCIES.items():
|
||||||
|
bin_name = settings.CONFIG[bin_key]
|
||||||
|
|
||||||
|
self.stdout.write(f'{bin_key}: {bin_name}')
|
||||||
|
|
||||||
|
# binary = Binary(name=package_name, providers=[env])
|
||||||
|
# print(binary)
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# loaded_bin = binary.load()
|
||||||
|
# self.stdout.write(
|
||||||
|
# self.style.SUCCESS(f'Successfully loaded {package_name}:') + str(loaded_bin)
|
||||||
|
# )
|
||||||
|
# except Exception as e:
|
||||||
|
# self.stderr.write(
|
||||||
|
# self.style.ERROR(f"Error loading {package_name}: {e}")
|
||||||
|
# )
|
||||||
|
|
||||||
|
def install(self, *args, bright, **options):
|
||||||
|
for package_name in options["package_names"]:
|
||||||
|
binary = Binary(name=package_name, providers=[env])
|
||||||
|
print(binary)
|
||||||
|
|
||||||
|
try:
|
||||||
|
loaded_bin = binary.load()
|
||||||
|
self.stdout.write(
|
||||||
|
self.style.SUCCESS(f'Successfully loaded {package_name}:') + str(loaded_bin)
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
self.stderr.write(
|
||||||
|
self.style.ERROR(f"Error loading {package_name}: {e}")
|
||||||
|
)
|
0
archivebox/pkg/migrations/__init__.py
Normal file
0
archivebox/pkg/migrations/__init__.py
Normal file
|
@ -1,4 +1,4 @@
|
||||||
__package__ = 'archivebox.pkgs'
|
__package__ = 'archivebox.pkg'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
Loading…
Add table
Add a link
Reference in a new issue