eaf0e86f5c
Hopefully we're at least close to the right stuff for handling python2 vs python3 right with these changes. OBS-URL: https://build.opensuse.org/request/show/569760 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=385
96 lines
3.7 KiB
Diff
96 lines
3.7 KiB
Diff
From 6b3d716e2b6472eb7189d3220552280ef3d832ce Mon Sep 17 00:00:00 2001
|
|
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
Date: Fri, 12 Jan 2018 13:53:44 +0000
|
|
Subject: [PATCH] Fix compat with py3 dict keys/values data types
|
|
|
|
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
tools/keymap-gen | 18 +++++++++---------
|
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/tools/keymap-gen b/tools/keymap-gen
|
|
index d4594b4..f0269e3 100755
|
|
--- a/tools/keymap-gen
|
|
+++ b/tools/keymap-gen
|
|
@@ -356,19 +356,19 @@ class LanguageSrcGenerator(LanguageGenerator):
|
|
|
|
if frommapname in database.ENUM_COLUMNS:
|
|
fromtype = self.TYPE_ENUM
|
|
- elif type(tolinux.keys()[0]) == str:
|
|
+ elif type(list(tolinux.keys())[0]) == str:
|
|
fromtype = self.TYPE_STRING
|
|
else:
|
|
fromtype = self.TYPE_INT
|
|
|
|
if tomapname in database.ENUM_COLUMNS:
|
|
totype = self.TYPE_ENUM
|
|
- elif type(fromlinux.values()[0]) == str:
|
|
+ elif type(list(fromlinux.values())[0]) == str:
|
|
totype = self.TYPE_STRING
|
|
else:
|
|
totype = self.TYPE_INT
|
|
|
|
- keys = tolinux.keys()
|
|
+ keys = list(tolinux.keys())
|
|
keys.sort()
|
|
if fromtype == self.TYPE_INT:
|
|
keys = range(keys[-1] + 1)
|
|
@@ -402,7 +402,7 @@ class LanguageSrcGenerator(LanguageGenerator):
|
|
raise Exception("Unknown map %s, expected one of %s" % (
|
|
mapname, ", ".join(database.mapto.keys())))
|
|
|
|
- keys = database.mapto[Database.MAP_LINUX].keys()
|
|
+ keys = list(database.mapto[Database.MAP_LINUX].keys())
|
|
keys.sort()
|
|
names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys]
|
|
|
|
@@ -411,7 +411,7 @@ class LanguageSrcGenerator(LanguageGenerator):
|
|
|
|
if mapname in database.ENUM_COLUMNS:
|
|
totype = self.TYPE_ENUM
|
|
- elif type(database.mapto[mapname].values()[0]) == str:
|
|
+ elif type(list(database.mapto[mapname].values())[0]) == str:
|
|
totype = self.TYPE_STRING
|
|
else:
|
|
totype = self.TYPE_INT
|
|
@@ -440,7 +440,7 @@ class LanguageSrcGenerator(LanguageGenerator):
|
|
if varname is None:
|
|
varname = "name_map_%s_to_%s" % (frommapname, tomapname)
|
|
|
|
- keys = tolinux.keys()
|
|
+ keys = list(tolinux.keys())
|
|
keys.sort()
|
|
if type(keys[0]) == int:
|
|
keys = range(keys[-1] + 1)
|
|
@@ -470,7 +470,7 @@ class LanguageSrcGenerator(LanguageGenerator):
|
|
raise Exception("Unknown map %s, expected one of %s" % (
|
|
mapname, ", ".join(database.mapname.keys())))
|
|
|
|
- keys = database.mapto[Database.MAP_LINUX].keys()
|
|
+ keys = list(database.mapto[Database.MAP_LINUX].keys())
|
|
keys.sort()
|
|
names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys]
|
|
|
|
@@ -514,7 +514,7 @@ class LanguageDocGenerator(LanguageGenerator):
|
|
raise Exception("Unknown map %s, expected one of %s" % (
|
|
mapname, ", ".join(database.mapname.keys())))
|
|
|
|
- keys = database.mapto[Database.MAP_LINUX].keys()
|
|
+ keys = list(database.mapto[Database.MAP_LINUX].keys())
|
|
keys.sort()
|
|
names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys]
|
|
|
|
@@ -537,7 +537,7 @@ class LanguageDocGenerator(LanguageGenerator):
|
|
mapname, ", ".join(database.mapfrom.keys())))
|
|
|
|
tolinux = database.mapfrom[mapname]
|
|
- keys = tolinux.keys()
|
|
+ keys = list(tolinux.keys())
|
|
keys.sort()
|
|
if mapname in database.mapname:
|
|
names = database.mapname[mapname]
|
|
--
|
|
2.15.1
|
|
|