From 7dd5b6a226e18439a8f4cb17bb09606b9c3ef153 Mon Sep 17 00:00:00 2001 From: alexhimmel Date: Mon, 17 Apr 2023 05:34:51 -0400 Subject: [PATCH] CP-41972: update xcp to support ack py3 Signed-off-by: alexhimmel --- xcp/net/biosdevname.py | 2 +- xcp/pci.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xcp/net/biosdevname.py b/xcp/net/biosdevname.py index 78995056..60ddfe82 100644 --- a/xcp/net/biosdevname.py +++ b/xcp/net/biosdevname.py @@ -65,7 +65,7 @@ def all_devices_all_names(): if retcode: continue - for device in (x.strip() for x in stdout.split("\n\n") if len(x)): + for device in (x.strip() for x in stdout.decode().split("\n\n") if len(x)): dinfo = {} for l in device.split("\n"): diff --git a/xcp/pci.py b/xcp/pci.py index 1c8e081d..703ab85d 100644 --- a/xcp/pci.py +++ b/xcp/pci.py @@ -186,7 +186,7 @@ def __init__(self, fn): vendor = None cls = None - fh = open(fn) + fh = open(fn, 'r', encoding='UTF-8') for l in fh: line = l.rstrip() if line == '' or line.startswith('#'): @@ -260,7 +260,7 @@ def __init__(self): stdout = subprocess.PIPE) for l in cmd.stdout: line = l.rstrip() - el = [x for x in line.replace('"', '').split() if not x.startswith('-')] + el = [x for x in line.decode().replace('"', '').split() if not x.startswith('-')] self.devs[el[0]] = {'id': el[0], 'class': el[1][:2], 'subclass': el[1][2:],