diff --git a/archivebox/pkgs/__init__.py b/archivebox/pkgs/__init__.py index c5f4cc82..3782fd92 100644 --- a/archivebox/pkgs/__init__.py +++ b/archivebox/pkgs/__init__.py @@ -7,16 +7,17 @@ PKGS_DIR = Path(__file__).parent VENDORED_PKGS = [ 'abx', # 'pydantic-pkgr', + # ... everything else in archivebox/pkgs/* comes after ... ] -# scan ./pkgs and add all dirs present to list of available VENDORED_PKGS +# VENDORED_PKGS += [ ... ./pkgs/* ... ] for subdir in reversed(sorted(PKGS_DIR.iterdir())): if subdir.is_dir() and subdir.name not in VENDORED_PKGS and not subdir.name.startswith('_'): VENDORED_PKGS.append(subdir.name) def load_vendored_pkgs(): - """Add archivebox/vendor to sys.path and import all vendored libraries present within""" + """Add archivebox/pkgs to sys.path and import all vendored python packages present within""" if str(PKGS_DIR) not in sys.path: sys.path.append(str(PKGS_DIR)) @@ -28,12 +29,12 @@ def load_vendored_pkgs(): lib = importlib.import_module(pkg_name) # print(f"Successfully imported lib from environment {pkg_name}") except ImportError: - sys.path.append(str(pkg_dir)) + sys.path.append(str(pkg_dir)) # perhaps the pkg is in a subdirectory of the directory try: lib = importlib.import_module(pkg_name) # print(f"Successfully imported lib from vendored fallback {pkg_name}: {inspect.getfile(lib)}") except ImportError as e: - print(f"Failed to import lib from environment or vendored fallback {pkg_name}: {e}", file=sys.stderr) + print(f"Failed to import required pkg from sys.path or archivebox/pkgs dir {pkg_name}: {e}", file=sys.stderr) sys.exit(1)