- bsc#1067263 - virt-install: ERROR unicode argument expected, got
'str' virtinst-fix-replace-StringIO-with-io.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=377
This commit is contained in:
parent
ba698f40db
commit
eb5d892eae
@ -10,10 +10,10 @@ Use either io.StringIO [2] for text or io.BytesIO [3] for bytes.
|
||||
[2] https://docs.python.org/3/library/io.html#text-i-o
|
||||
[3] https://docs.python.org/3/library/io.html#binary-i-o
|
||||
|
||||
Index: virt-manager-1.4.3/tests/clitest.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/tests/clitest.py
|
||||
+++ virt-manager-1.4.3/tests/clitest.py
|
||||
diff --git a/tests/clitest.py b/tests/clitest.py
|
||||
index bdc1b44..cf140a9 100644
|
||||
--- a/tests/clitest.py
|
||||
+++ b/tests/clitest.py
|
||||
@@ -16,6 +16,7 @@
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
@ -39,10 +39,10 @@ Index: virt-manager-1.4.3/tests/clitest.py
|
||||
sys.stdout = out
|
||||
sys.stderr = out
|
||||
sys.argv = self.argv
|
||||
Index: virt-manager-1.4.3/tests/virtconvtest.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/tests/virtconvtest.py
|
||||
+++ virt-manager-1.4.3/tests/virtconvtest.py
|
||||
diff --git a/tests/virtconvtest.py b/tests/virtconvtest.py
|
||||
index f804883..3afb392 100644
|
||||
--- a/tests/virtconvtest.py
|
||||
+++ b/tests/virtconvtest.py
|
||||
@@ -18,8 +18,8 @@
|
||||
from __future__ import print_function
|
||||
|
||||
@ -62,10 +62,10 @@ Index: virt-manager-1.4.3/tests/virtconvtest.py
|
||||
def print_cb(msg):
|
||||
print(msg, file=outbuf)
|
||||
|
||||
Index: virt-manager-1.4.3/virtManager/create.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/virtManager/create.py
|
||||
+++ virt-manager-1.4.3/virtManager/create.py
|
||||
diff --git a/virtManager/create.py b/virtManager/create.py
|
||||
index 8b4d75d..5629396 100644
|
||||
--- a/virtManager/create.py
|
||||
+++ b/virtManager/create.py
|
||||
@@ -18,10 +18,10 @@
|
||||
# MA 02110-1301 USA.
|
||||
#
|
||||
@ -87,10 +87,10 @@ Index: virt-manager-1.4.3/virtManager/create.py
|
||||
|
||||
# Get virt-bootstrap logger
|
||||
vbLogger = logging.getLogger('virtBootstrap')
|
||||
Index: virt-manager-1.4.3/virtManager/snapshots.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/virtManager/snapshots.py
|
||||
+++ virt-manager-1.4.3/virtManager/snapshots.py
|
||||
diff --git a/virtManager/snapshots.py b/virtManager/snapshots.py
|
||||
index eeb1a9f..0d905e3 100644
|
||||
--- a/virtManager/snapshots.py
|
||||
+++ b/virtManager/snapshots.py
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
import datetime
|
||||
@ -111,10 +111,10 @@ Index: virt-manager-1.4.3/virtManager/snapshots.py
|
||||
def _write_cb(_stream, data, userdata):
|
||||
ignore = stream
|
||||
ignore = userdata
|
||||
Index: virt-manager-1.4.3/virtinst/urlfetcher.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/virtinst/urlfetcher.py
|
||||
+++ virt-manager-1.4.3/virtinst/urlfetcher.py
|
||||
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
|
||||
index c57c9e1..ebc5c7a 100644
|
||||
--- a/virtinst/urlfetcher.py
|
||||
+++ b/virtinst/urlfetcher.py
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
import ConfigParser
|
||||
@ -128,16 +128,7 @@ Index: virt-manager-1.4.3/virtinst/urlfetcher.py
|
||||
import subprocess
|
||||
import tempfile
|
||||
import urllib2
|
||||
@@ -104,6 +104,8 @@ class _URLFetcher(object):
|
||||
buff = urlobj.read(self._block_size)
|
||||
if not buff:
|
||||
break
|
||||
+ if isinstance(fileobj, io.StringIO) and type(buff) is str:
|
||||
+ buff = unicode(buff)
|
||||
fileobj.write(buff)
|
||||
total += len(buff)
|
||||
self.meter.update(total)
|
||||
@@ -169,7 +171,7 @@ class _URLFetcher(object):
|
||||
@@ -169,7 +169,7 @@ class _URLFetcher(object):
|
||||
"""
|
||||
Grab the passed filename from self.location and return it as a string
|
||||
"""
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 8 13:59:11 MST 2017 - carnold@suse.com
|
||||
|
||||
- bsc#1067263 - virt-install: ERROR unicode argument expected, got
|
||||
'str'
|
||||
virtinst-fix-replace-StringIO-with-io.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 27 14:19:35 MDT 2017 - carnold@suse.com
|
||||
|
||||
|
@ -111,6 +111,7 @@ Patch166: virtinst-check-date-format.patch
|
||||
Patch167: virtinst-no-usb-tablet-for-xenpv.patch
|
||||
Patch168: virtinst-add-sle15-detection-support.patch
|
||||
Patch169: virtinst-keep-install-iso-attached.patch
|
||||
Patch170: virtinst-fix-replace-StringIO-with-io.patch
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -267,6 +268,7 @@ machine).
|
||||
%patch167 -p1
|
||||
%patch168 -p1
|
||||
%patch169 -p1
|
||||
%patch170 -p1
|
||||
|
||||
%build
|
||||
%if %{qemu_user}
|
||||
|
26
virtinst-fix-replace-StringIO-with-io.patch
Normal file
26
virtinst-fix-replace-StringIO-with-io.patch
Normal file
@ -0,0 +1,26 @@
|
||||
Commit 75210ed37c0c5de569de73e04488808a2521a011 changed the file
|
||||
object type such that the write method requires a unicode value
|
||||
instead of a string. This is a follow-up patch to that commmit.
|
||||
|
||||
Index: virt-manager-1.4.3/virtinst/urlfetcher.py
|
||||
===================================================================
|
||||
--- virt-manager-1.4.3.orig/virtinst/urlfetcher.py
|
||||
+++ virt-manager-1.4.3/virtinst/urlfetcher.py
|
||||
@@ -105,6 +105,8 @@ class _URLFetcher(object):
|
||||
buff = urlobj.read(self._block_size)
|
||||
if not buff:
|
||||
break
|
||||
+ if isinstance(fileobj, io.StringIO) and type(buff) is str:
|
||||
+ buff = unicode(buff)
|
||||
fileobj.write(buff)
|
||||
total += len(buff)
|
||||
self.meter.update(total)
|
||||
@@ -207,6 +209,8 @@ class _HTTPURLFetcher(_URLFetcher):
|
||||
"""
|
||||
total = 0
|
||||
for data in urlobj.iter_content(chunk_size=self._block_size):
|
||||
+ if isinstance(fileobj, io.StringIO) and type(data) is str:
|
||||
+ data = unicode(data)
|
||||
fileobj.write(data)
|
||||
total += len(data)
|
||||
self.meter.update(total)
|
Loading…
Reference in New Issue
Block a user