!17 Use ValueError instead of ImportError to catch exception when importing GIR binding

From: @xuiny 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2023-01-09 06:24:36 +00:00 committed by Gitee
commit a751c9f73b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,32 @@
From 96e1f5b242f4be5b20d408e6f526caaaecf34a48 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
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

View File

@ -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 <xuxinyu@xfusion.com> - 1.5.11-16
* Mon Jan 09 2023 xuxinyu <xuxinyu@xfusion.com> - 1.5.11-17
- Use ValueError instead of ImportError to catch exception
- when importing GIR bindings
* Sat Jan 07 2023 xuxinyu <xuxinyu@xfusion.com> - 1.5.11-16
- Fix constructing the auth dialog
* Tue Sep 08 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.5.11-15