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 <[email protected]> Signed-off-by: Andrew Cooper <[email protected]> --- CC: George Dunlap <[email protected]> CC: Ian Jackson <[email protected]> CC: Jan Beulich <[email protected]> CC: Konrad Rzeszutek Wilk <[email protected]> CC: Stefano Stabellini <[email protected]> CC: Tim Deegan <[email protected]> CC: Wei Liu <[email protected]> CC: Julien Grall <[email protected]> CC: Juergen Gross <[email protected]> This is a nice-to-have for 4.12 because it makes our build system more compatible with bleeding edge distros. I've not got the time to figure out why mkheader needs to process types in reverse order of their type names, but checker.c doesn't compile if the list is sorted differently. --- tools/include/xen-foreign/mkchecker.py | 2 +- tools/include/xen-foreign/mkheader.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py index fdad869..199b0ee 100644 --- a/tools/include/xen-foreign/mkchecker.py +++ b/tools/include/xen-foreign/mkchecker.py @@ -37,7 +37,7 @@ for struct in structs: 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: diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py index 97e0c7a..d876831 100644 --- a/tools/include/xen-foreign/mkheader.py +++ b/tools/include/xen-foreign/mkheader.py @@ -205,9 +205,7 @@ for struct in structs: 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 -- 2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
