From 72f777059f3aa499db1c7f4036560abd87c98f86 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 22 Oct 2024 02:25:20 -0700 Subject: [PATCH] minor plugin improvements --- archivebox/abx/hookspec.py | 8 +++++++ archivebox/plugins_extractor/wget/__init__.py | 22 ++++++++++--------- archivebox/plugins_pkg/npm/__init__.py | 18 ++++++++------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/archivebox/abx/hookspec.py b/archivebox/abx/hookspec.py index 88685b8d..a25f7673 100644 --- a/archivebox/abx/hookspec.py +++ b/archivebox/abx/hookspec.py @@ -10,5 +10,13 @@ impl = hookimpl = HookimplMarker("abx") @hookspec @hookimpl def get_system_user() -> str: + # Beware $HOME may not match current EUID, UID, PUID, SUID, there are edge cases + # - sudo (EUD != UID != SUID) + # - running with an autodetected UID based on data dir ownership + # but mapping of UID:username is broken because it was created + # by a different host system, e.g. 911's $HOME outside of docker + # might be /usr/lib/lxd instead of /home/archivebox + # - running as a user that doens't have a home directory + # - home directory is set to a path that doesn't exist, or is inside a dir we cant read return Path('~').expanduser().name diff --git a/archivebox/plugins_extractor/wget/__init__.py b/archivebox/plugins_extractor/wget/__init__.py index 2b546836..e2a36aa4 100644 --- a/archivebox/plugins_extractor/wget/__init__.py +++ b/archivebox/plugins_extractor/wget/__init__.py @@ -1,8 +1,9 @@ __package__ = 'plugins_extractor.wget' -__label__ = 'wget' +__id__ = 'wget' +__label__ = 'WGET' __version__ = '2024.10.14' __author__ = 'ArchiveBox' -__homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/main/archivebox/plugins_extractor/wget' +__homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/dev/archivebox/plugins_extractor/wget' __dependencies__ = [] import abx @@ -11,13 +12,14 @@ import abx @abx.hookimpl def get_PLUGIN(): return { - 'wget': { - 'PACKAGE': __package__, - 'LABEL': __label__, - 'VERSION': __version__, - 'AUTHOR': __author__, - 'HOMEPAGE': __homepage__, - 'DEPENDENCIES': __dependencies__, + __id__: { + 'id': __id__, + 'package': __package__, + 'label': __label__, + 'version': __version__, + 'author': __author__, + 'homepage': __homepage__, + 'dependencies': __dependencies__, } } @@ -26,7 +28,7 @@ def get_CONFIG(): from .config import WGET_CONFIG return { - 'wget': WGET_CONFIG + __id__: WGET_CONFIG } @abx.hookimpl diff --git a/archivebox/plugins_pkg/npm/__init__.py b/archivebox/plugins_pkg/npm/__init__.py index 0164aa38..921d42e4 100644 --- a/archivebox/plugins_pkg/npm/__init__.py +++ b/archivebox/plugins_pkg/npm/__init__.py @@ -1,6 +1,7 @@ __package__ = 'plugins_pkg.npm' -__label__ = 'npm' __version__ = '2024.10.14' +__id__ = 'npm' +__label__ = 'npm' __author__ = 'ArchiveBox' __homepage__ = 'https://www.npmjs.com/' @@ -10,12 +11,13 @@ import abx @abx.hookimpl def get_PLUGIN(): return { - 'npm': { - 'PACKAGE': __package__, - 'LABEL': __label__, - 'VERSION': __version__, - 'AUTHOR': __author__, - 'HOMEPAGE': __homepage__, + __id__: { + 'id': __id__, + 'package': __package__, + 'label': __label__, + 'version': __version__, + 'author': __author__, + 'homepage': __homepage__, } } @@ -24,7 +26,7 @@ def get_CONFIG(): from .config import NPM_CONFIG return { - 'npm': NPM_CONFIG, + __id__: NPM_CONFIG, } @abx.hookimpl