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
This commit is contained in:
parent
05afc374ae
commit
36c3f5d843
30
0001-virtinst-python3-terminal-width-should-be-int.patch
Normal file
30
0001-virtinst-python3-terminal-width-should-be-int.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 79fa0f9de08f766dee6129fdc2c48648bba6fc6e Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Thu, 7 Dec 2017 11:09:02 +0100
|
||||
Subject: [PATCH 1/4] virtinst: python3: terminal width should be int
|
||||
|
||||
This avoids errors like this:
|
||||
|
||||
File "/usr/share/virt-manager/virtinst/progress.py", line 224, in _term_add_bar
|
||||
return tl.add(' [%-*.*s]' % (blen, blen, bar))
|
||||
TypeError: * wants int
|
||||
---
|
||||
virtinst/progress.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virtinst/progress.py b/virtinst/progress.py
|
||||
index 868d0f0f0544..e07591a14fa0 100644
|
||||
--- a/virtinst/progress.py
|
||||
+++ b/virtinst/progress.py
|
||||
@@ -79,7 +79,7 @@ class TerminalLine:
|
||||
a number of different elements (default=2). """
|
||||
if self._llen < fixed:
|
||||
return 0
|
||||
- return (self._llen - fixed) / elements
|
||||
+ return int((self._llen - fixed) / elements)
|
||||
|
||||
def add(self, element, full_len=None):
|
||||
""" If there is room left in the line, above min_len, add element.
|
||||
--
|
||||
2.15.1
|
||||
|
41
0002-virtinst-python3-avoid-comparison-of-None-and-int.patch
Normal file
41
0002-virtinst-python3-avoid-comparison-of-None-and-int.patch
Normal file
@ -0,0 +1,41 @@
|
||||
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
|
||||
|
38
0003-virtinst-python3-avoid-using-long-type.patch
Normal file
38
0003-virtinst-python3-avoid-using-long-type.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 955c4f03d623461c4e06d9f39eea7ac305104b0a Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Thu, 7 Dec 2017 11:21:21 +0100
|
||||
Subject: [PATCH 3/4] virtinst: python3: avoid using long type
|
||||
|
||||
Avoids the following error:
|
||||
|
||||
File "/usr/share/virt-manager/virtinst/progress.py", line 484, in format_number
|
||||
if isinstance(number, int) or isinstance(number, long):
|
||||
NameError: name 'long' is not defined
|
||||
---
|
||||
virtinst/progress.py | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virtinst/progress.py b/virtinst/progress.py
|
||||
index eef3f7613506..bea4fad98938 100644
|
||||
--- a/virtinst/progress.py
|
||||
+++ b/virtinst/progress.py
|
||||
@@ -30,6 +30,7 @@ import math
|
||||
import fcntl
|
||||
import struct
|
||||
import termios
|
||||
+from six import integer_types
|
||||
|
||||
# Code from http://mail.python.org/pipermail/python-list/2000-May/033365.html
|
||||
def terminal_width(fd=1):
|
||||
@@ -481,7 +482,7 @@ def format_number(number, SI=0, space=' '):
|
||||
depth = depth + 1
|
||||
number = number / step
|
||||
|
||||
- if isinstance(number, int) or isinstance(number, int):
|
||||
+ if isinstance(number, integer_types):
|
||||
# it's an int or a long, which means it didn't get divided,
|
||||
# which means it's already short enough
|
||||
fmt = '%i%s%s'
|
||||
--
|
||||
2.15.1
|
||||
|
34
0004-virtinst-python3-use-binary-mode-for-kernel.patch
Normal file
34
0004-virtinst-python3-use-binary-mode-for-kernel.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 1e38d32429205ed8fbd088bcfe2dfea4229544b6 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Thu, 7 Dec 2017 12:42:45 +0100
|
||||
Subject: [PATCH 4/4] virtinst: python3: use binary mode for kernel
|
||||
|
||||
This avoids the following error:
|
||||
|
||||
File "/usr/share/virt-manager/virtinst/kernelupload.py", line 146, in upload_kernel_initrd
|
||||
kvol = _upload_file(conn, meter, pool, kernel)
|
||||
File "/usr/share/virt-manager/virtinst/kernelupload.py", line 105, in _upload_file
|
||||
data = fileobj.read(blocksize)
|
||||
File "/usr/lib64/python3.6/codecs.py", line 321, in decode
|
||||
(result, consumed) = self._buffer_decode(data, self.errors, final)
|
||||
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 2: invalid continuation byte
|
||||
---
|
||||
virtinst/kernelupload.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virtinst/kernelupload.py b/virtinst/kernelupload.py
|
||||
index 80bb9c6d1143..5caeb51c4100 100644
|
||||
--- a/virtinst/kernelupload.py
|
||||
+++ b/virtinst/kernelupload.py
|
||||
@@ -93,7 +93,7 @@ def _upload_file(conn, meter, destpool, src):
|
||||
vol.upload(stream, offset, length, flags)
|
||||
|
||||
# Open source file
|
||||
- fileobj = open(src, "r")
|
||||
+ fileobj = open(src, "rb")
|
||||
|
||||
# Start transfer
|
||||
total = 0
|
||||
--
|
||||
2.15.1
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 7 11:49:29 UTC 2017 - mwilck@suse.com
|
||||
|
||||
- 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 2 18:41:22 MST 2017 - carnold@suse.com
|
||||
|
||||
|
@ -122,6 +122,11 @@ Patch202: virtconv-python2-to-python3-conversion.patch
|
||||
Patch203: virtinst-python2-to-python3-conversion.patch
|
||||
Patch204: virtman-python2-to-python3-conversion.patch
|
||||
Patch205: virttests-python2-to-python3-conversion.patch
|
||||
Patch206: 0001-virtinst-python3-terminal-width-should-be-int.patch
|
||||
Patch207: 0002-virtinst-python3-avoid-comparison-of-None-and-int.patch
|
||||
Patch208: 0003-virtinst-python3-avoid-using-long-type.patch
|
||||
Patch209: 0004-virtinst-python3-use-binary-mode-for-kernel.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -289,6 +294,10 @@ machine).
|
||||
%patch203 -p1
|
||||
%patch204 -p1
|
||||
%patch205 -p1
|
||||
%patch206 -p1
|
||||
%patch207 -p1
|
||||
%patch208 -p1
|
||||
%patch209 -p1
|
||||
|
||||
%build
|
||||
%if %{qemu_user}
|
||||
|
Loading…
Reference in New Issue
Block a user