From e237ddf990c058517b09ee2cd27eadae26d7b1ae Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 10 Oct 2007 15:39:20 +0000 Subject: [PATCH] - fix type checking of strings to also include unicode strings; fixes regets from yum (#235618) --- python-urlgrabber.spec | 8 ++++- urlgrabber-string-type.patch | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 urlgrabber-string-type.patch diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index aa72db0..9952361 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -3,9 +3,10 @@ Summary: A high-level cross-protocol url-grabber Name: python-urlgrabber Version: 3.0.0 -Release: 2%{?dist} +Release: 3%{?dist} Source0: urlgrabber-%{version}.tar.gz Patch0: urlgrabber-keepalive.patch +Patch1: urlgrabber-string-type.patch License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -22,6 +23,7 @@ authentication, proxies and more. %prep %setup -q -n urlgrabber-%{version} %patch0 -p0 +%patch1 -p1 %build python setup.py build @@ -41,6 +43,10 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/urlgrabber %changelog +* Wed Oct 10 2007 Jeremy Katz - 3.0.0-3 +- fix type checking of strings to also include unicode strings; fixes + regets from yum (#235618) + * Mon Aug 27 2007 Jeremy Katz - 3.0.0-2 - fixes for package review (#226347) diff --git a/urlgrabber-string-type.patch b/urlgrabber-string-type.patch new file mode 100644 index 0000000..bc96da7 --- /dev/null +++ b/urlgrabber-string-type.patch @@ -0,0 +1,60 @@ +diff -up urlgrabber-3.0.0/urlgrabber/progress.py.type urlgrabber-3.0.0/urlgrabber/progress.py +--- urlgrabber-3.0.0/urlgrabber/progress.py.type 2007-10-10 11:34:55.000000000 -0400 ++++ urlgrabber-3.0.0/urlgrabber/progress.py 2007-10-10 11:36:50.000000000 -0400 +@@ -23,6 +23,7 @@ import sys + import time + import math + import thread ++import types + + class BaseMeter: + def __init__(self): +@@ -343,7 +344,7 @@ class TextMultiFileMeter(MultiFileMeter) + try: + format = "%-30.30s %6.6s %s" + fn = meter.basename +- if type(message) in (type(''), type(u'')): ++ if type(message) in types.StringTypes: + message = message.splitlines() + if not message: message = [''] + out = '%-79s' % (format % (fn, 'FAILED', message[0] or '')) +diff -up urlgrabber-3.0.0/urlgrabber/mirror.py.type urlgrabber-3.0.0/urlgrabber/mirror.py +--- urlgrabber-3.0.0/urlgrabber/mirror.py.type 2007-10-10 11:35:22.000000000 -0400 ++++ urlgrabber-3.0.0/urlgrabber/mirror.py 2007-10-10 11:36:14.000000000 -0400 +@@ -90,6 +90,7 @@ CUSTOMIZATION + + import random + import thread # needed for locking to make this threadsafe ++import types + + from grabber import URLGrabError, CallbackObject, DEBUG + +@@ -266,7 +267,7 @@ class MirrorGroup: + def _parse_mirrors(self, mirrors): + parsed_mirrors = [] + for m in mirrors: +- if type(m) == type(''): m = {'mirror': m} ++ if type(m) in types.StringTypes: m = {'mirror': m} + parsed_mirrors.append(m) + return parsed_mirrors + +diff -up urlgrabber-3.0.0/urlgrabber/grabber.py.type urlgrabber-3.0.0/urlgrabber/grabber.py +--- urlgrabber-3.0.0/urlgrabber/grabber.py.type 2007-10-10 11:34:50.000000000 -0400 ++++ urlgrabber-3.0.0/urlgrabber/grabber.py 2007-10-10 11:35:51.000000000 -0400 +@@ -372,6 +372,7 @@ import sys + import urlparse + import rfc822 + import time ++import types + import string + import urllib + import urllib2 +@@ -1128,7 +1129,7 @@ class URLGrabberFileObject: + self.append = 0 + reget_length = 0 + rt = None +- if have_range and self.opts.reget and type(self.filename) == type(''): ++ if have_range and self.opts.reget and type(self.filename) in types.StringTypes: + # we have reget turned on and we're dumping to a file + try: + s = os.stat(self.filename)