From 38b1a41f2b24bb242f37d8dec98d95f9bc30952b Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Mon, 1 Aug 2022 15:25:10 +0900 Subject: [PATCH] build: add pyinstaller hooks for dvc-task and celery --- scripts/pyinstaller/hooks/hook-celery.py | 16 ++++++++++++++++ scripts/pyinstaller/hooks/hook-dvc_task.py | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 scripts/pyinstaller/hooks/hook-celery.py create mode 100644 scripts/pyinstaller/hooks/hook-dvc_task.py diff --git a/scripts/pyinstaller/hooks/hook-celery.py b/scripts/pyinstaller/hooks/hook-celery.py new file mode 100644 index 000000000..4b96c9a70 --- /dev/null +++ b/scripts/pyinstaller/hooks/hook-celery.py @@ -0,0 +1,16 @@ +# pylint: disable=import-error +from PyInstaller.utils.hooks import collect_submodules, is_module_or_submodule + +# Celery dynamically imports most celery internals at runtime +# pyinstaller hook must expose all modules loaded by +# kombu.utils.imports:symbol_by_name() +_EXCLUDES = ( + "celery.bin", + "celery.contrib", +) +hiddenimports = collect_submodules( + "celery", + filter=lambda name: not any( + is_module_or_submodule(name, module) for module in _EXCLUDES + ), +) diff --git a/scripts/pyinstaller/hooks/hook-dvc_task.py b/scripts/pyinstaller/hooks/hook-dvc_task.py new file mode 100644 index 000000000..6a46c85dd --- /dev/null +++ b/scripts/pyinstaller/hooks/hook-dvc_task.py @@ -0,0 +1,4 @@ +# pylint: disable=import-error +from PyInstaller.utils.hooks import collect_submodules + +hiddenimports = collect_submodules("dvc_task")