rpms/python-urlgrabber/devel urlgrabber-3.0.0-progress-C-c+serial-console.patch, NONE, 1.1 python-urlgrabber.spec, 1.34, 1.35

James Antill james at fedoraproject.org
Wed Apr 8 14:38:01 UTC 2009


Author: james

Update of /cvs/pkgs/rpms/python-urlgrabber/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18456

Modified Files:
	python-urlgrabber.spec 
Added Files:
	urlgrabber-3.0.0-progress-C-c+serial-console.patch 
Log Message:
* Wed Apr  8 2009 James Antill <james at fedoraproject.org> 3.0.0-15
- Fix progress bars for serial consoles.
- Make C-c behaviour a little nicer.


urlgrabber-3.0.0-progress-C-c+serial-console.patch:

--- NEW FILE urlgrabber-3.0.0-progress-C-c+serial-console.patch ---
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~


Index: python-urlgrabber.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-urlgrabber/devel/python-urlgrabber.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- python-urlgrabber.spec	13 Mar 2009 14:51:19 -0000	1.34
+++ python-urlgrabber.spec	8 Apr 2009 14:37:30 -0000	1.35
@@ -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 @@
 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 @@
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 
 %build
 python setup.py build
@@ -59,6 +62,10 @@
 %{_bindir}/urlgrabber
 
 %changelog
+* Wed Apr  8 2009 James Antill <james at fedoraproject.org> 3.0.0-15
+- Fix progress bars for serial consoles.
+- Make C-c behaviour a little nicer.
+
 * Fri Mar 13 2009 Seth Vidal <skvidal at fedoraproject.org>
 - kill deprecation warning from importing md5 if anyone uses keepalive
 




More information about the scm-commits mailing list