diff options
author | Vinson Lee <[email protected]> | 2020-06-05 00:36:55 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-06 08:20:13 +0000 |
commit | 6a841dbf4e4f0cb33bc36a8ba880a9bd6f6e7941 (patch) | |
tree | 4bfa78eafa3d8aa7c7a066d5b93af1e752c39477 | |
parent | 06650a771dc44b3f5628b6d172e224a103a79762 (diff) |
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 <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5348>
-rwxr-xr-x | src/intel/genxml/gen_sort_tags.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/intel/genxml/gen_sort_tags.py b/src/intel/genxml/gen_sort_tags.py index f87bb2bfe6e..10fe8d4b178 100755 --- a/src/intel/genxml/gen_sort_tags.py +++ b/src/intel/genxml/gen_sort_tags.py @@ -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 |