[at-spi2-core: 22/30] generate-introspection.py: Is now able to process multiple input filenames
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core: 22/30] generate-introspection.py: Is now able to process multiple input filenames
- Date: Mon, 4 Jul 2022 19:25:18 +0000 (UTC)
commit 2e2d1b8404a4f53f7b36775caf641e65f78c327f
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jul 4 12:07:59 2022 -0500
generate-introspection.py: Is now able to process multiple input filenames
python3 gnerate-introspection.py --c-output=foo.c --h-output=foo.h file1.xml file2.xml file3.xml
With this, we can generate the introspection.[ch] files consistently.
xml/generate-introspection.py | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/xml/generate-introspection.py b/xml/generate-introspection.py
index 08f1900c..33d77b79 100644
--- a/xml/generate-introspection.py
+++ b/xml/generate-introspection.py
@@ -60,11 +60,7 @@ def convert_contents (contents):
literals = ["\"%s\"" % (line) for line in contents.split ("\n")]
return "\n".join (literals)
-def generate_introspection (input_filename, c_output_filename, h_output_filename):
- #Open the XML file and process includes.
- tree = ElementTree.parse (input_filename)
- root = tree.getroot ()
-
+def generate_introspection (inputs, c_output_filename, h_output_filename):
#Open the output files.
cfile = open (c_output_filename, "w")
hfile = open (h_output_filename, "w")
@@ -72,16 +68,21 @@ def generate_introspection (input_filename, c_output_filename, h_output_filename
ccontents = ""
hcontents = ""
- for itf in root.findall ("interface"):
- #Get and convert the name of the interface.
- name = convert_name (itf.attrib["name"])
+ for input_filename in inputs:
+ #Open the XML file and process includes.
+ tree = ElementTree.parse (input_filename)
+ root = tree.getroot ()
+
+ for itf in root.findall ("interface"):
+ #Get and convert the name of the interface.
+ name = convert_name (itf.attrib["name"])
- #Create the introspection string with version information.
- itf.attrib["version"] = VERSION
- contents = convert_contents (ElementTree.tostring (itf, encoding="unicode"))
+ #Create the introspection string with version information.
+ itf.attrib["version"] = VERSION
+ contents = convert_contents (ElementTree.tostring (itf, encoding="unicode"))
- hcontents += DECTEMPLATE % (name)
- ccontents += DEFTEMPLATE % (name, contents)
+ hcontents += DECTEMPLATE % (name)
+ ccontents += DEFTEMPLATE % (name, contents)
cfile.write (CTEMPLATE % (ccontents))
hfile.write (HTEMPLATE % (hcontents))
@@ -100,4 +101,4 @@ if __name__ == "__main__":
c_output_filename = sys.argv[2]
h_output_filename = sys.argv[3]
- generate_introspection (args.sources[0], args.c_output, args.h_output)
+ generate_introspection (args.sources, args.c_output, args.h_output)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]