!62 backport Fix compatibility with python3 in putFile method

From: @liyy9 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2023-12-29 03:26:42 +00:00 committed by Gitee
commit e1d320c328
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 9fb1f6a731dab0c39ba138d29f310622d4f32d4d Mon Sep 17 00:00:00 2001
From: Tomas Korbar <tkorbar@redhat.com>
Date: Mon, 14 Jan 2019 16:09:25 +0100
Subject: [PATCH] Fix compatibility with python3 in putFile method
in python3 os.read returns byte object not a string which caused
writing loop to be endless
by adding b'' comparison we hold compatibility both with python2
and python3
---
cupspk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cupspk.py b/cupspk.py
index 5b863b43..b7cbc0b3 100644
--- a/cupspk.py
+++ b/cupspk.py
@@ -448,7 +448,7 @@ class Connection:
if fd is not None:
os.lseek (fd, 0, os.SEEK_SET)
buf = os.read (fd, 512)
- while buf != '':
+ while buf != '' and buf != b'':
os.write (tmpfd, buf)
buf = os.read (fd, 512)
else:
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: system-config-printer
Summary: a graphical tool for CUPS administration
Version: 1.5.11
Release: 22
Release: 23
License: GPLv2+
URL: https://github.com/zdohnal/system-config-printer
Source0: https://github.com/zdohnal/system-config-printer/archive/%{version}.tar.gz
@ -16,6 +16,7 @@ Patch0005: 0005-Fix-TypeError-raised-by-debugprint-call.patch
Patch0006: 0006-Fix-bad-use-of-NamedTemporaryFile.patch
Patch0007: 0007-Fix-bad-call-of-cups-connection-getFile.patch
Patch0008: 0008-Fix-writing-of-advanced-settings.patch
Patch0009: 0009-Fix-compatibility-with-python3-in-putFile-method.patch
BuildRequires: libusb1-devel gcc gettext-devel systemd xmlto systemd-devel python3-devel
BuildRequires: intltool cups-devel >= 1.2 desktop-file-utils >= 0.2.92 pkgconfig(glib-2.0)
@ -91,6 +92,9 @@ rm -rf /var/cache/foomatic/foomatic.pickle
exit 0
%changelog
* Thu Dec 28 2023 liyuanyuan <liyuanyuan@xfusion.com> - 1.5.11-23
- Fix compatibility with python3 in putFile method
* Tue Dec 12 2023 liyuanyuan <liyuanyuan@xfusion.com> - 1.5.11-22
- Fix writing of advanced settings