virt-manager/0002-virtinst-python3-avoid-comparison-of-None-and-int.patch
Charles Arnold 36c3f5d843 Accepting request 555017 from home:mwilck:branches:Virtualization
- More fixes for python3 (bsc#1070896)
  0001-virtinst-python3-terminal-width-should-be-int.patch
  0002-virtinst-python3-avoid-comparison-of-None-and-int.patch
  0003-virtinst-python3-avoid-using-long-type.patch
  0004-virtinst-python3-use-binary-mode-for-kernel.patch

OBS-URL: https://build.opensuse.org/request/show/555017
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=384
2017-12-07 17:12:07 +00:00

42 lines
1.4 KiB
Diff

From cb90bbc8671aa25e23e55341745cc2682547e5f0 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 7 Dec 2017 11:17:03 +0100
Subject: [PATCH 2/4] virtinst: python3: avoid comparison of None and int
This avoids the following error in python3:
File "/usr/share/virt-manager/virtinst/progress.py", line 249, in _do_update
ave_dl = format_number(self.re.average_rate())
File "/usr/share/virt-manager/virtinst/progress.py", line 481, in format_number
while number > thresh and depth < max_depth:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
---
virtinst/progress.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/virtinst/progress.py b/virtinst/progress.py
index e07591a14fa0..eef3f7613506 100644
--- a/virtinst/progress.py
+++ b/virtinst/progress.py
@@ -339,7 +339,7 @@ class RateEstimator:
self.start_time = now
self.last_update_time = now
self.last_amount_read = 0
- self.ave_rate = None
+ self.ave_rate = 0
def update(self, amount_read, now=None):
if now is None: now = time.time()
@@ -351,7 +351,7 @@ class RateEstimator:
# if we just started this file, all bets are off
self.last_update_time = now
self.last_amount_read = amount_read
- self.ave_rate = None
+ self.ave_rate = 0
return
#print 'times', now, self.last_update_time
--
2.15.1