From 50614d52fcb1ee72f286236794662d5788ca460a Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Thu, 12 Jan 2023 15:37:27 -0800 Subject: [PATCH] Update PyInstaller hook --- comicapi/__pyinstaller/hook-comicapi.py | 4 ++-- comicapi/comicarchive.py | 21 +++++++++++---------- setup.py | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/comicapi/__pyinstaller/hook-comicapi.py b/comicapi/__pyinstaller/hook-comicapi.py index 0be9c56..6101d69 100644 --- a/comicapi/__pyinstaller/hook-comicapi.py +++ b/comicapi/__pyinstaller/hook-comicapi.py @@ -1,6 +1,6 @@ from __future__ import annotations -from PyInstaller.utils.hooks import collect_data_files +from PyInstaller.utils.hooks import collect_data_files, collect_entry_point -datas = [] +datas, hiddenimports = collect_entry_point("comicapi.archiver") datas += collect_data_files("comicapi.data") diff --git a/comicapi/comicarchive.py b/comicapi/comicarchive.py index 05da647..18e0eb4 100644 --- a/comicapi/comicarchive.py +++ b/comicapi/comicarchive.py @@ -53,16 +53,17 @@ archivers: list[type[Archiver]] = [] def load_archive_plugins() -> None: - for arch in entry_points(group="comicapi_archivers"): - try: - archiver: type[Archiver] = arch.load() - if archiver.enabled: - if not arch.module.startswith("comicapi"): - archivers.insert(0, archiver) - else: - archivers.append(archiver) - except Exception: - logger.warning("Failed to load talker: %s", arch.name) + if not archivers: + for arch in entry_points(group="comicapi.archiver"): + try: + archiver: type[Archiver] = arch.load() + if archiver.enabled: + if not arch.module.startswith("comicapi"): + archivers.insert(0, archiver) + else: + archivers.append(archiver) + except Exception: + logger.warning("Failed to load talker: %s", arch.name) class MetaDataStyle: diff --git a/setup.py b/setup.py index 014b996..a6f8c0f 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ setup( "pyinstaller40": [ "hook-dirs = comictaggerlib.__pyinstaller:get_hook_dirs", ], - "comicapi.archivers": [ + "comicapi.archiver": [ "zip = comicapi.archivers.zip:ZipArchiver", "sevenzip = comicapi.archivers.sevenzip:SevenZipArchiver", "rar = comicapi.archivers.rar:RarArchiver",