[master 20/30] Handle modules returning bytes in Python 3 (#1014220)
M4rtinK
installerbot-noreply at redhat.com
Mon Jun 1 14:04:37 UTC 2015
From: Martin Kolman <mkolman at redhat.com>
For example rpm and vncconfig.
---
pyanaconda/packaging/__init__.py | 3 ++-
pyanaconda/ui/gui/utils.py | 11 ++++++-----
pyanaconda/vnc.py | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index f93b1f1..433757d 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -714,8 +714,9 @@ def kernelVersionList(self):
ts = rpm.TransactionSet(iutil.getSysroot())
mi = ts.dbMatch('providename', 'kernel')
for hdr in mi:
+ unicode_fnames = (f.decode("utf-8") for f in hdr.filenames)
# Find all /boot/vmlinuz- files and strip off vmlinuz-
- files.extend((f.split("/")[-1][8:] for f in hdr.filenames
+ files.extend((f.split("/")[-1][8:] for f in unicode_fnames
if fnmatch(f, "/boot/vmlinuz-*") or
fnmatch(f, "/boot/efi/EFI/%s/vmlinuz-*" % self.instclass.efi_dir)))
diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py
index 619874d..7fcff75 100644
--- a/pyanaconda/ui/gui/utils.py
+++ b/pyanaconda/ui/gui/utils.py
@@ -320,10 +320,11 @@ def ignoreEscape(dlg):
escape key to do nothing for the given GtkDialog.
"""
provider = Gtk.CssProvider()
- provider.load_from_data("@binding-set IgnoreEscape {"
- " unbind 'Escape';"
- "}"
- "GtkDialog { gtk-key-bindings: IgnoreEscape }")
+ provider.load_from_data(bytes("@binding-set IgnoreEscape {"
+ " unbind 'Escape';"
+ "}"
+ "GtkDialog { gtk-key-bindings: IgnoreEscape }",
+ "utf-8"))
context = dlg.get_style_context()
context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
@@ -335,7 +336,7 @@ def setViewportBackground(vp, color="@theme_bg_color"):
"""
provider = Gtk.CssProvider()
- provider.load_from_data("GtkViewport { background-color: %s }" % color)
+ provider.load_from_data(bytes("GtkViewport { background-color: %s }" % color, "utf-8"))
context = vp.get_style_context()
context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
diff --git a/pyanaconda/vnc.py b/pyanaconda/vnc.py
index c17e10d..2905268 100644
--- a/pyanaconda/vnc.py
+++ b/pyanaconda/vnc.py
@@ -163,7 +163,7 @@ def connectToView(self):
for _i in range(maxTries):
vncconfp = iutil.startProgram(vncconfigcommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # vncconfig process
- err = vncconfp.communicate()[1]
+ err = vncconfp.communicate()[1].decode("utf-8")
if err == '':
self.log.info(_("Connected!"))
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/3660beed921062b90bc766cc89a1290c9e5ad2e4
More information about the anaconda-patches
mailing list