Commit 6a841dbf authored by Vinson Lee's avatar Vinson Lee Committed by Marge Bot

intel/genxml: Migrate from deprecated xml.etree.ElementTree getchildren.

xml.etree.ElementTree getchildren was deprecated since Python 2.7 and
will be removed in Python 3.9.
Signed-off-by: Vinson Lee's avatarVinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Engestrom's avatarEric Engestrom <eric@engestrom.ch>
Part-of: <!5348>
parent 06650a77
Pipeline #157034 passed with stages
in 10 minutes and 3 seconds
......@@ -66,7 +66,7 @@ def add_struct_refs(items, node):
return
if node.tag != 'struct' and node.tag != 'group':
return
for c in node.getchildren():
for c in node:
add_struct_refs(items, c)
......@@ -116,7 +116,7 @@ def print_node(f, offset, node):
for a in attribs:
if a in node.attrib:
f.write(' {0}="{1}"'.format(a, node.attrib[a]))
children = node.getchildren()
children = list(node)
if len(children) > 0:
f.write('>\n')
for c in children:
......@@ -134,7 +134,7 @@ def process(filename):
enum_dict = {}
for e in enums:
values = e.findall('./value')
e[:] = sorted(e.getchildren(), key=get_value)
e[:] = sorted(e, key=get_value)
enum_dict[e.attrib['name']] = e
# Structs are a bit annoying because they can refer to each other. We sort
......@@ -143,7 +143,7 @@ def process(filename):
structs = sorted(xml.findall('./struct'), key=get_name)
wrapped_struct_dict = {}
for s in structs:
s[:] = sorted(s.getchildren(), key=get_start)
s[:] = sorted(s, key=get_start)
ws = Struct(s)
wrapped_struct_dict[ws.name] = ws
......@@ -157,11 +157,11 @@ def process(filename):
instructions = sorted(xml.findall('./instruction'), key=get_name)
for i in instructions:
i[:] = sorted(i.getchildren(), key=get_start)
i[:] = sorted(i, key=get_start)
registers = sorted(xml.findall('./register'), key=get_name)
for r in registers:
r[:] = sorted(r.getchildren(), key=get_start)
r[:] = sorted(r, key=get_start)
genxml[:] = enums + list(sorted_structs.values()) + instructions + registers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment