- Make urlgrabber usable if openssl is broken

- Relates: bug#454179
epel9
James Antill 17 years ago
parent 314b2915d0
commit 2ea74188da

@ -3,7 +3,7 @@
Summary: A high-level cross-protocol url-grabber
Name: python-urlgrabber
Version: 3.0.0
Release: 8%{?dist}
Release: 9%{?dist}
Source0: urlgrabber-%{version}.tar.gz
Patch0: urlgrabber-keepalive.patch
Patch1: urlgrabber-string-type.patch
@ -11,6 +11,7 @@ Patch2: urlgrabber-3.0.0-cleanup.patch
Patch3: urlgrabber-ftp-port.patch
Patch4: urlgrabber-progress-ui.patch
Patch5: urlgrabber-grab-no-range.patch
Patch6: urlgrabber-no-ssl-ok.patch
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@ -30,8 +31,9 @@ authentication, proxies and more.
%patch1 -p1
%patch2 -p1
%patch3 -p0
%patch4 -p0
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
python setup.py build
@ -51,6 +53,13 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/urlgrabber
%changelog
* Thu Jul 10 2008 James Antill <james@fedoraproject.org> 3.0.0-9
- Make urlgrabber usable if openssl is broken
- Relates: bug#454179
* Sun Jun 15 2008 James Antill <james@fedoraproject.org> 3.0.0-9
- Don't count partial downloads toward the total
* Sat May 18 2008 James Antill <james@fedoraproject.org> 3.0.0-8
- Tweak progress output so it's hopefully less confusing
- Add dynamic resizing ability to progress bar

@ -0,0 +1,25 @@
diff -rup urlgrabber-3.0.0-orig/urlgrabber/keepalive.py urlgrabber-3.0.0/urlgrabber/keepalive.py
--- urlgrabber-3.0.0-orig/urlgrabber/keepalive.py 2006-07-20 16:15:58.000000000 -0400
+++ urlgrabber-3.0.0/urlgrabber/keepalive.py 2008-07-10 17:37:06.000000000 -0400
@@ -328,12 +328,16 @@ class HTTPHandler(KeepAliveHandler, urll
def http_open(self, req):
return self.do_open(HTTPConnection, req)
-class HTTPSHandler(KeepAliveHandler, urllib2.HTTPSHandler):
- def __init__(self):
- KeepAliveHandler.__init__(self)
+# If SSL isn't available, don't make urlgrabber completely unusable
+try:
+ class HTTPSHandler(KeepAliveHandler, urllib2.HTTPSHandler):
+ def __init__(self):
+ KeepAliveHandler.__init__(self)
- def https_open(self, req):
- return self.do_open(HTTPSConnection, req)
+ def https_open(self, req):
+ return self.do_open(HTTPSConnection, req)
+except:
+ pass
class HTTPResponse(httplib.HTTPResponse):
# we need to subclass HTTPResponse in order to

@ -1,12 +1,7 @@
Index: urlgrabber/progress.py
===================================================================
RCS file: /home/groups/urlgrabber/cvs-root/urlgrabber/urlgrabber/progress.py,v
retrieving revision 1.7
diff -u -r1.7 progress.py
--- urlgrabber/progress.py 19 Aug 2005 21:59:07 -0000 1.7
+++ urlgrabber/progress.py 17 May 2008 17:33:32 -0000
@@ -23,8 +23,75 @@
import time
diff -rup urlgrabber-3.0.0-orig/urlgrabber/progress.py urlgrabber-3.0.0/urlgrabber/progress.py
--- urlgrabber-3.0.0-orig/urlgrabber/progress.py 2008-06-16 00:48:52.000000000 -0400
+++ urlgrabber-3.0.0/urlgrabber/progress.py 2008-06-16 00:49:25.000000000 -0400
@@ -24,7 +24,74 @@ import time
import math
import thread
import types
@ -82,7 +77,7 @@ diff -u -r1.7 progress.py
class BaseMeter:
def __init__(self):
self.update_period = 0.3 # seconds
@@ -83,6 +150,64 @@
@@ -84,6 +151,64 @@ class BaseMeter:
def _do_end(self, amount_read, now=None):
pass
@ -147,7 +142,7 @@ diff -u -r1.7 progress.py
class TextMeter(BaseMeter):
def __init__(self, fo=sys.stderr):
BaseMeter.__init__(self)
@@ -97,37 +222,73 @@
@@ -98,38 +223,80 @@ class TextMeter(BaseMeter):
text = self.text
else:
text = self.basename
@ -226,15 +221,22 @@ diff -u -r1.7 progress.py
+ ui_size, ui_time, ui_end)
+ self.fo.write(out)
self.fo.flush()
+ # Don't add size to the sofar size until we have all of it.
+ # If we don't have a size, then just pretend/hope we got all of it.
+ if self.size is not None and amount_read != self.size:
+ return
+
+ if _text_meter_total_size:
+ _text_meter_sofar_size += amount_read
+ if _text_meter_total_size <= _text_meter_sofar_size:
+ _text_meter_total_size = 0
+ _text_meter_sofar_size = 0
+
text_progress_meter = TextMeter
@@ -396,10 +557,12 @@
class MultiFileHelper(BaseMeter):
@@ -397,10 +564,12 @@ class RateEstimator:
#print 'times', now, self.last_update_time
time_diff = now - self.last_update_time
read_diff = amount_read - self.last_amount_read
@ -250,7 +252,7 @@ diff -u -r1.7 progress.py
#print 'results', time_diff, read_diff, self.ave_rate
#####################################################################
@@ -528,3 +691,49 @@
@@ -529,3 +698,49 @@ def format_number(number, SI=0, space='
format = '%.0f%s%s'
return(format % (float(number or 0), space, symbols[depth]))
@ -300,3 +302,4 @@ diff -u -r1.7 progress.py
+ (100000, 0.1), (10000, 0.1), (10000, 0.1), (10000, 0.1),
+ (100000, 0.1), (10000, 0.1), (10000, 0.1), (10000, 0.1),
+ (100000, 0.1), (1, 0.1))
Only in urlgrabber-3.0.0/urlgrabber: progress.py.orig

Loading…
Cancel
Save