[python-urlgrabber] Fix UTF-8 behaviour (bz #1135632)

Valentina Mukhamedzhanova vmukhame at fedoraproject.org
Wed Sep 3 12:28:22 UTC 2014


commit 9a2719055a7e146744c8cc5e6837c4cac0d8c3ec
Author: Tomas Radej <tradej at redhat.com>
Date:   Tue Sep 2 13:01:15 2014 +0200

    Fix UTF-8 behaviour (bz #1135632)

 fix-stringio.patch     |   31 +++++++++++++++++++++++++++++++
 python-urlgrabber.spec |    7 ++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/fix-stringio.patch b/fix-stringio.patch
new file mode 100644
index 0000000..cbb1e96
--- /dev/null
+++ b/fix-stringio.patch
@@ -0,0 +1,31 @@
+From 62f94b534289b7ab0bda879962bf6efb124a9930 Mon Sep 17 00:00:00 2001
+From: Tomas Radej <tradej at redhat.com>
+Date: Tue, 2 Sep 2014 12:52:50 +0200
+Subject: [PATCH] StringIO patch
+
+---
+ urlgrabber/grabber.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
+index 35c091e..26335d1 100644
+--- a/urlgrabber/grabber.py
++++ b/urlgrabber/grabber.py
+@@ -1298,12 +1298,12 @@ class PyCurlFileObject(object):
+                     start = self._range[0] - pos
+                     stop = self._range[1] - pos
+                     if start < len(buf) and stop > 0:
+-                        if not six.PY3 or isinstance(self.fo, StringIO):
++                        if not six.PY3 and isinstance(self.fo, StringIO):
+                             self.fo.write(buf[max(start, 0):stop].decode('utf-8'))
+                         else:
+                             self.fo.write(buf[max(start, 0):stop])
+                 else:
+-                    if not six.PY3 or isinstance(self.fo, StringIO):
++                    if not six.PY3 and isinstance(self.fo, StringIO):
+                         self.fo.write(buf.decode('utf-8'))
+                     else:
+                         self.fo.write(buf)
+-- 
+1.9.3
+
diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec
index c810c38..aa07e19 100644
--- a/python-urlgrabber.spec
+++ b/python-urlgrabber.spec
@@ -3,12 +3,13 @@
 Summary: A high-level cross-protocol url-grabber
 Name: python-urlgrabber
 Version: 3.10.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 Source0: http://urlgrabber.baseurl.org/download/urlgrabber-%{version}.tar.gz
 Patch1: urlgrabber-HEAD.patch
 Patch2: BZ-1051554-speed-on-404-mirror.patch
 Patch3: port-to-python3.patch
 Patch4: port-tests-to-python3.patch
+Patch5: fix-stringio.patch
 
 License: LGPLv2+
 Group: Development/Libraries
@@ -30,6 +31,7 @@ authentication, proxies and more.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %build
 python setup.py build
@@ -52,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0755,root,root) %{_libexecdir}/urlgrabber-ext-down
 
 %changelog
+* Tue Sep 02 2014 Tomas Radej <tradej at redhat.com> - 3.10.1-4
+- Fixed UTF behaviour (bz #1135632)
+
 * Fri Aug 29 2014 Valentina Mukhamedzhanova <vmukhame at redhat.com> - 3.10.1-3
 - Don't set speed=0 on a new mirror that 404'd. BZ 1051554
 - Support both Python 2 and 3. BZ 985288


More information about the scm-commits mailing list