The issues are:
* dict.has_key() was completely removed in Py3
* dict.keys() is an iterable rather than list in Py3, so .sort() doesn't work.
* list.sort(cmp=) was deprecated in Py2.4 and removed in Py3. Replace it
with a key= sort instead.
This is all compatible with Py2.4 and later, which is when the sorted()
builtin was introduced. Tested with Py2.7 and Py3.4
Reported-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
f.write('\tprintf("%%-25s |", "%s");\n' % struct);
for a in archs:
s = struct + "_" + a;
- if compat_arches.has_key(a):
+ if a in compat_arches:
compat = compat_arches[a]
c = struct + "_" + compat;
else:
output = re.sub("\\b(%s)_t\\b" % struct, "\\1_%s_t" % arch, output);
# replace: integer types
-integers = inttypes[arch].keys();
-integers.sort(lambda a, b: cmp(len(b),len(a)));
-for type in integers:
+for type in sorted(inttypes[arch].keys(), key = lambda x: -len(x)):
output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output);
# print results