Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1 | From c54ae9c524998e449b822feb465a0c90317cd735 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 20 Sep 2022 15:10:26 +0100 |
| 4 | Subject: [PATCH] trivial: Fix compile when using python 3.7 or older |
| 5 | |
| 6 | Upstream-Status: Backport [https://github.com/fwupd/fwupd/pull/5051] |
| 7 | Signed-off-by: Richard Hughes <richard@hughsie.com> |
| 8 | --- |
| 9 | contrib/generate-gresource-xml.py | 5 ++++- |
| 10 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 11 | |
| 12 | diff --git a/contrib/generate-gresource-xml.py b/contrib/generate-gresource-xml.py |
| 13 | index 235a770020..569c804937 100755 |
| 14 | --- a/contrib/generate-gresource-xml.py |
| 15 | +++ b/contrib/generate-gresource-xml.py |
| 16 | @@ -23,6 +23,9 @@ |
| 17 | n_file.set("preprocess", "xml-stripblanks") |
| 18 | n_file.set("alias", os.path.basename(fn)) |
| 19 | with open(sys.argv[1], "wb") as f: |
| 20 | - f.write(ET.tostring(root, "utf-8", xml_declaration=True)) |
| 21 | + try: |
| 22 | + f.write(ET.tostring(root, "utf-8", xml_declaration=True)) |
| 23 | + except TypeError: |
| 24 | + f.write(ET.tostring(root, "utf-8")) |
| 25 | |
| 26 | sys.exit(0) |