[PATCH 08/32] sync_qemu_models_i386: Switch to lxml

Jiri Denemark posted 32 patches 2 weeks ago
There is a newer version of this series
[PATCH 08/32] sync_qemu_models_i386: Switch to lxml
Posted by Jiri Denemark 2 weeks ago
XMLs parse/format round trip using lxml results in an XML document that
almost exactly matches the original (including comments).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu_map/sync_qemu_models_i386.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index b2ed890589..75d86144d0 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -4,7 +4,7 @@ import argparse
 import copy
 import os
 import re
-import xml.etree.ElementTree
+import lxml.etree
 
 import lark
 
@@ -591,7 +591,7 @@ def main():
 
     try:
         filename = os.path.join(args.outdir, "x86_features.xml")
-        dom = xml.etree.ElementTree.parse(filename)
+        dom = lxml.etree.parse(filename)
         known = [x.attrib["name"] for x in dom.getroot().iter("feature")]
         unknown = [x for x in features if x not in known and x is not None]
     except Exception as e:
-- 
2.47.0
Re: [PATCH 08/32] sync_qemu_models_i386: Switch to lxml
Posted by Daniel P. Berrangé 1 week, 6 days ago
On Tue, Nov 19, 2024 at 07:49:44PM +0100, Jiri Denemark wrote:
> XMLs parse/format round trip using lxml results in an XML document that
> almost exactly matches the original (including comments).
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/cpu_map/sync_qemu_models_i386.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|