From 6e18915c150b483136567641799c127a824a62bb Mon Sep 17 00:00:00 2001 From: xuxinyu Date: Mon, 9 Jan 2023 10:21:58 +0800 Subject: [PATCH] Use ValueError instead of ImportError to catch exception when importing GIR binding Signed-off-by: xuxinyu --- ...nstead-of-ImportError-to-catch-excep.patch | 32 +++++++++++++++++++ system-config-printer.spec | 9 ++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Use-ValueError-instead-of-ImportError-to-catch-excep.patch diff --git a/Use-ValueError-instead-of-ImportError-to-catch-excep.patch b/Use-ValueError-instead-of-ImportError-to-catch-excep.patch new file mode 100644 index 0000000..abd6075 --- /dev/null +++ b/Use-ValueError-instead-of-ImportError-to-catch-excep.patch @@ -0,0 +1,32 @@ +From 96e1f5b242f4be5b20d408e6f526caaaecf34a48 Mon Sep 17 00:00:00 2001 +From: Laurent Bigonville +Date: Mon, 26 Feb 2018 11:17:22 +0100 +Subject: [PATCH] Use ValueError instead of ImportError to catch + exception when importing GIR bindings + +When importing specific version of GIR bindings, the ValueError +exception is raised instead of ImportError. + +This should make libsecret optional as intended + +Fixes: #94 +--- + jobviewer.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/jobviewer.py b/jobviewer.py +index 6d9309ff..16b20300 100644 +--- a/jobviewer.py ++++ b/jobviewer.py +@@ -57,7 +57,7 @@ try: + gi.require_version('Secret', '1') + from gi.repository import Secret + USE_SECRET=True +-except ImportError: ++except ValueError: + USE_SECRET=False + + import gettext +-- +2.25.1 + diff --git a/system-config-printer.spec b/system-config-printer.spec index 459a7e4..e1c1ca3 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -3,7 +3,7 @@ Name: system-config-printer Summary: a graphical tool for CUPS administration Version: 1.5.11 -Release: 16 +Release: 17 License: GPLv2+ URL: https://github.com/zdohnal/system-config-printer Source0: https://github.com/zdohnal/system-config-printer/archive/%{version}.tar.gz @@ -22,6 +22,7 @@ Provides: %{name}-libs = %{version}-%{release} %{name}-applet = %{version} Provides: %{name}-udev = %{version}-%{release} hal-cups-utils = 0.6.20 Patch1: Fix-constructing-the-auth-dialog.patch +Patch2: Use-ValueError-instead-of-ImportError-to-catch-excep.patch %description %{name} is a graphical tool for CUPS administration. It @@ -83,7 +84,11 @@ rm -rf /var/cache/foomatic/foomatic.pickle exit 0 %changelog -* Sat Jan 07 2022 xuxinyu - 1.5.11-16 +* Mon Jan 09 2023 xuxinyu - 1.5.11-17 +- Use ValueError instead of ImportError to catch exception +- when importing GIR bindings + +* Sat Jan 07 2023 xuxinyu - 1.5.11-16 - Fix constructing the auth dialog * Tue Sep 08 2020 zhangjiapeng - 1.5.11-15 -- Gitee