blob: 947c764030f448763f50b8025e17a1f9477875fc [file] [log] [blame]
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001From c54ae9c524998e449b822feb465a0c90317cd735 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 20 Sep 2022 15:10:26 +0100
4Subject: [PATCH] trivial: Fix compile when using python 3.7 or older
5
6Upstream-Status: Backport [https://github.com/fwupd/fwupd/pull/5051]
7Signed-off-by: Richard Hughes <richard@hughsie.com>
8---
9 contrib/generate-gresource-xml.py | 5 ++++-
10 1 file changed, 4 insertions(+), 1 deletion(-)
11
12diff --git a/contrib/generate-gresource-xml.py b/contrib/generate-gresource-xml.py
13index 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)