Additional python3 fixes

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=382
This commit is contained in:
Charles Arnold 2017-12-04 14:27:28 +00:00 committed by Git OBS Bridge
parent cd5a32c5f9
commit 05afc374ae

View File

@ -441,6 +441,15 @@ Index: virt-manager-1.4.3/virtinst/urlfetcher.py
try:
try:
@@ -278,7 +282,7 @@ class _LocalURLFetcher(_URLFetcher):
return os.path.exists(url)
def _grabber(self, url):
- urlobj = open(url, "r")
+ urlobj = open(url, "rb")
size = os.path.getsize(url)
return urlobj, size
@@ -371,14 +375,14 @@ def _grabTreeinfo(fetcher):
return None
@ -458,7 +467,29 @@ Index: virt-manager-1.4.3/virtinst/urlfetcher.py
logging.debug("Did not find 'family' section in treeinfo")
return None
@@ -618,7 +622,7 @@ class Distro(object):
@@ -391,11 +395,13 @@ def _distroFromSUSEContent(fetcher, arch
# None if no content, GenericDistro if unknown label type.
try:
cbuf = fetcher.acquireFileContent("content")
+ cbuf = cbuf.decode()
except ValueError:
try:
# If no content file, try media.1/products and media.1/build and create
# a cbuf with enough info for the content file parsing code below to work
pbuf = fetcher.acquireFileContent("media.1/products").strip()
+ pbuf = pbuf.decode()
pbuf = pbuf.split(' ', 1)[1].strip()
# The media.1/products file naming convention changed between SLE11 and SLE12
if pbuf.startswith('SLE'):
@@ -404,6 +410,7 @@ def _distroFromSUSEContent(fetcher, arch
cbuf = "\nDISTRO ," + pbuf.replace('-', ' ')
try:
bbuf = fetcher.acquireFileContent("media.1/build").split('-')
+ bbuf = bbuf.decode()
except:
bbuf = ["x86_64"]
cbuf = cbuf + "\n" + " ".join(bbuf)
@@ -618,7 +625,7 @@ class Distro(object):
try:
kernelpath = self._getTreeinfoMedia("kernel")
initrdpath = self._getTreeinfoMedia("initrd")
@ -467,7 +498,15 @@ Index: virt-manager-1.4.3/virtinst/urlfetcher.py
pass
if not kernelpath or not initrdpath:
@@ -754,15 +758,15 @@ class GenericDistro(Distro):
@@ -685,6 +692,7 @@ class Distro(object):
# Fetch 'filename' and return True/False if it matches the regex
try:
content = self.fetcher.acquireFileContent(filename)
+ content = content.decode()
except ValueError:
return False
@@ -754,15 +762,15 @@ class GenericDistro(Distro):
self._valid_kernel_path = (
self._getTreeinfoMedia("kernel"),
self._getTreeinfoMedia("initrd"))
@ -486,7 +525,7 @@ Index: virt-manager-1.4.3/virtinst/urlfetcher.py
logging.debug(e)
if self.type == "xen":
@@ -1437,7 +1441,7 @@ class ALTLinuxDistro(Distro):
@@ -1437,7 +1445,7 @@ class ALTLinuxDistro(Distro):
# Build list of all *Distro classes
def _build_distro_list():
allstores = []