[python-urlgrabber] Fix a bug in progress display code. BZ 847105.

Zdeněk Pavlas zpavlas at fedoraproject.org
Fri Aug 10 08:21:41 UTC 2012


commit 651b5b9090658ef4f12573f0ea140eaf1caf007c
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Fri Aug 10 10:21:07 2012 +0200

    Fix a bug in progress display code. BZ 847105.

 python-urlgrabber.spec |    5 ++++-
 urlgrabber-HEAD.patch  |   14 ++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec
index d84d5d2..15a948f 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.9.1
-Release: 16%{?dist}
+Release: 17%{?dist}
 Source0: urlgrabber-%{version}.tar.gz
 Patch1: urlgrabber-HEAD.patch
 
@@ -44,6 +44,9 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0755,root,root) %{_libexecdir}/urlgrabber-ext-down
 
 %changelog
+* Wed Aug 10 2012 Zdeněk Pavlas <zpavlas at redhat.com> - 3.9.1-17
+- Fix a bug in progress display code. BZ 847105.
+
 * Wed Aug  8 2012 Zdeněk Pavlas <zpavlas at redhat.com> - 3.9.1-16
 - Update to latest head.
 - Improved multi-file progress, small bugfixes.
diff --git a/urlgrabber-HEAD.patch b/urlgrabber-HEAD.patch
index 67e6567..3d53ec6 100644
--- a/urlgrabber-HEAD.patch
+++ b/urlgrabber-HEAD.patch
@@ -1710,7 +1710,7 @@ index dad410b..ac78b34 100644
      def urlopen(self, url, **kwargs):
          kw = dict(kwargs)
 diff --git a/urlgrabber/progress.py b/urlgrabber/progress.py
-index dd07c6a..5a02707 100644
+index dd07c6a..ad57dbc 100644
 --- a/urlgrabber/progress.py
 +++ b/urlgrabber/progress.py
 @@ -211,6 +211,21 @@ def text_meter_total_size(size, downloaded=0):
@@ -1832,7 +1832,7 @@ index dd07c6a..5a02707 100644
              pd = 100 * (self.re.fraction_read() or 0) + 0.49
              dt = self.re.elapsed_time()
              rt = self.re.remaining_time()
-@@ -491,9 +518,39 @@ class TextMultiFileMeter(MultiFileMeter):
+@@ -491,9 +518,41 @@ class TextMultiFileMeter(MultiFileMeter):
              ftd = format_number(td) + 'B'
              fdt = format_time(dt, 1)
              ftt = format_time(tt, 1)
@@ -1846,7 +1846,9 @@ index dd07c6a..5a02707 100644
 +            # cycle through active meters
 +            if now > self.index_time:
 +                self.index_time = now + 1.0
-+                self.index = (self.index + 1) % len(self.meters)
++                self.index += 1
++            if self.index >= len(self.meters):
++                self.index = 0
 +            meter = self.meters[self.index]
 +            text = meter.text or meter.basename
 +            if tf > 1:
@@ -1875,7 +1877,7 @@ index dd07c6a..5a02707 100644
              self.fo.flush()
          finally:
              self._lock.release()
-@@ -502,18 +559,30 @@ class TextMultiFileMeter(MultiFileMeter):
+@@ -502,18 +561,30 @@ class TextMultiFileMeter(MultiFileMeter):
          self._lock.acquire()
          try:
              format = "%-30.30s %6.6s    %8.8s    %9.9s"
@@ -1912,7 +1914,7 @@ index dd07c6a..5a02707 100644
  
      def _do_failure_meter(self, meter, message, now):
          self._lock.acquire()
-@@ -536,15 +605,6 @@ class TextMultiFileMeter(MultiFileMeter):
+@@ -536,15 +607,6 @@ class TextMultiFileMeter(MultiFileMeter):
              pass
          finally:
              self._lock.release()
@@ -1928,7 +1930,7 @@ index dd07c6a..5a02707 100644
          
  ######################################################################
  # support classes and functions
-@@ -658,6 +718,8 @@ def format_time(seconds, use_hours=0):
+@@ -658,6 +720,8 @@ def format_time(seconds, use_hours=0):
      if seconds is None or seconds < 0:
          if use_hours: return '--:--:--'
          else:         return '--:--'


More information about the scm-commits mailing list