From ccc5f7dbcaf2c1f0778d1459b246ee56cf6baf57 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Fri, 19 Apr 2024 21:47:31 +0200 Subject: [PATCH] hooks: gcloud: suppress errors Supress errors raised by `copy_metadata`; these may occur when the hook is triggered by the `gcloud` namespace package from `gcloud-aio-*` and `gcloud-rest-*` dists instead of the `gcloud` package from the `gcloud` dist. --- news/731.update.rst | 3 +++ .../hooks/stdhooks/hook-gcloud.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 news/731.update.rst diff --git a/news/731.update.rst b/news/731.update.rst new file mode 100644 index 000000000..858240dd9 --- /dev/null +++ b/news/731.update.rst @@ -0,0 +1,3 @@ +Suppress errors in ``gcloud`` hook that occur when the hook is triggered +by the ``gcloud`` namespace package from ``gcloud-aio-*`` and ``gcloud-rest-*`` +dists instead of the ``gcloud`` package from the ``gcloud`` dist. diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gcloud.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gcloud.py index 5af7750af..dbf6962d0 100644 --- a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gcloud.py +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gcloud.py @@ -12,4 +12,10 @@ from PyInstaller.utils.hooks import copy_metadata -datas = copy_metadata('gcloud') +# This hook was written for `gcloud` - https://pypi.org/project/gcloud +# Suppress package-not-found errors when the hook is triggered by `gcloud` namespace package from `gcloud-aio-*` and +# `gcloud-rest-*˙ dists (https://github.com/talkiq/gcloud-aio). +try: + datas = copy_metadata('gcloud') +except Exception: + pass