[PATCH v1 4/4] scripts: apibuild: add 'version' to variables

Victor Toso victortoso at redhat.com
Tue Apr 5 11:43:23 UTC 2022


Differently from the previous patches, we don't parse nor export
comments associated with variables. This isn't a big deal because we
only export a single variable: virConnectAuthPtrDefault

Nonetheless, add version field to the exported XML by checking the
allowlist file. This way, if we add another variable in the future, we
can simply add it to that file. Calling the function should also warn
in case we are exporting a new Variable without adding to the file,
e.g:
    Missing 'Since' tag for: virConnectAuthPtrDefault

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 scripts/apibuild.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/apibuild.py b/scripts/apibuild.py
index 1235e75999..5493b3065e 100755
--- a/scripts/apibuild.py
+++ b/scripts/apibuild.py
@@ -2341,12 +2341,14 @@ class docBuilder:
 
     def serialize_variable(self, output, name):
         id = self.idx.variables[name]
+        # Only a single variable exported at the moment. Comments are not parser nor exported.
+        (_, since) = self.retrieve_comment_tags(name, "")
         if id.info is not None:
-            output.write("    <variable name='%s' file='%s' type='%s'/>\n" % (
-                name, self.modulename_file(id.header), id.info))
+            output.write("    <variable name='%s' file='%s' type='%s' version='%s'/>\n" % (
+                name, self.modulename_file(id.header), id.info, since))
         else:
-            output.write("    <variable name='%s' file='%s'/>\n" % (
-                name, self.modulename_file(id.header)))
+            output.write("    <variable name='%s' file='%s' version='%s'/>\n" % (
+                name, self.modulename_file(id.header), since))
 
     def serialize_function(self, output, name):
         id = self.idx.functions[name]
-- 
2.35.1



More information about the libvir-list mailing list