diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index 1473408..1c2a202 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -3,7 +3,7 @@ Summary: A high-level cross-protocol url-grabber Name: python-urlgrabber Version: 3.0.0 -Release: 14%{?dist} +Release: 15%{?dist} Source0: urlgrabber-%{version}.tar.gz Patch0: urlgrabber-keepalive.patch Patch1: urlgrabber-string-type.patch @@ -15,6 +15,8 @@ Patch6: urlgrabber-no-ssl-ok.patch Patch7: urlgrabber-extra-progress.patch Patch8: urlgrabber-file-checkfunc.patch Patch9: md5-hashlib.patch +Patch10: urlgrabber-3.0.0-progress-C-c+serial-console.patch + License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -40,6 +42,7 @@ authentication, proxies and more. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %build python setup.py build @@ -59,6 +62,10 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/urlgrabber %changelog +* Wed Apr 8 2009 James Antill 3.0.0-15 +- Fix progress bars for serial consoles. +- Make C-c behaviour a little nicer. + * Fri Mar 13 2009 Seth Vidal - kill deprecation warning from importing md5 if anyone uses keepalive diff --git a/urlgrabber-3.0.0-progress-C-c+serial-console.patch b/urlgrabber-3.0.0-progress-C-c+serial-console.patch new file mode 100644 index 0000000..5ea31b3 --- /dev/null +++ b/urlgrabber-3.0.0-progress-C-c+serial-console.patch @@ -0,0 +1,58 @@ +diff -ru urlgrabber-3.0.0-orig/urlgrabber/progress.py urlgrabber-3.0.0/urlgrabber/progress.py +--- urlgrabber-3.0.0-orig/urlgrabber/progress.py 2009-04-08 10:24:52.000000000 -0400 ++++ urlgrabber-3.0.0/urlgrabber/progress.py 2009-04-08 10:31:51.000000000 -0400 +@@ -34,7 +34,11 @@ + try: + buf = 'abcdefgh' + buf = fcntl.ioctl(fd, termios.TIOCGWINSZ, buf) +- return struct.unpack('hhhh', buf)[1] ++ ret = struct.unpack('hhhh', buf)[1] ++ if ret == 0: ++ return 80 ++ # Add minimum too? ++ return ret + except: # IOError + return 80 + +@@ -237,7 +241,7 @@ + ui_time = tl.add(' %9s' % fetime) + ui_end = tl.add(' ' * 5) + ui_rate = tl.add(' %5sB/s' % ave_dl) +- out = '\r%-*.*s%s%s%s%s' % (tl.rest(), tl.rest(), text, ++ out = '%-*.*s%s%s%s%s\r' % (tl.rest(), tl.rest(), text, + ui_rate, ui_size, ui_time, ui_end) + else: + rtime = self.re.remaining_time() +@@ -261,7 +265,7 @@ + if (blen * frac) - int(blen * frac) >= 0.5: + bar += '-' + ui_bar = tl.add(' [%-*.*s]' % (blen, blen, bar)) +- out = '\r%-*.*s%s%s%s%s%s%s%s' % (tl.rest(), tl.rest(), text, ++ out = '%-*.*s%s%s%s%s%s%s%s\r' % (tl.rest(), tl.rest(), text, + ui_sofar_pc, ui_pc, ui_bar, + ui_rate, ui_size, ui_time, ui_end) + +@@ -282,7 +286,12 @@ + tl = TerminalLine(8) + ui_size = tl.add(' | %5sB' % total_size) + ui_time = tl.add(' %9s' % total_time) +- ui_end = tl.add(' ' * 5) ++ not_done = self.size is not None and amount_read != self.size ++ if not_done: ++ ui_end = tl.add(' ... ') ++ else: ++ ui_end = tl.add(' ' * 5) ++ + out = '\r%-*.*s%s%s%s\n' % (tl.rest(), tl.rest(), text, + ui_size, ui_time, ui_end) + self.fo.write(out) +@@ -290,7 +299,7 @@ + + # 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: ++ if not_done: + return + + if _text_meter_total_size: +Only in urlgrabber-3.0.0/urlgrabber: progress.py~