From 749add6a46e77821b8a547efd347448e65ef27c4 Mon Sep 17 00:00:00 2001 From: xuxinyu Date: Mon, 9 Jan 2023 10:26:49 +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 | 7 +++- 2 files changed, 38 insertions(+), 1 deletion(-) 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 9d607d2..9a9da7f 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,6 +84,10 @@ rm -rf /var/cache/foomatic/foomatic.pickle exit 0 %changelog +* Mon Jan 09 2023 xuxinyu - 1.5.11-17 +- Use ValueError instead of ImportError to catch exception +- when importing GIR bindings + * Mon Jan 09 2023 xuxinyu - 1.5.11-16 - Fix constructing the auth dialog -- Gitee