[PATCH v3 25/30] scripts: apibuild: parse 'Since' for typedefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds 'version' parameter to the generated XML API for
typedefs

It'll require, for new additions, to add a comment with the version
that the typedef value was added. An example bellow of code diff and
the change in the generated XML.

Note that the Since tag is removed from the comment as there is a
proper field for it in the XML.

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
---
 scripts/apibuild.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/scripts/apibuild.py b/scripts/apibuild.py
index ddc2fff7af..24ca98bd1c 100755
--- a/scripts/apibuild.py
+++ b/scripts/apibuild.py
@@ -2298,9 +2298,11 @@ class docBuilder:
 
     def serialize_typedef(self, output, name):
         id = self.idx.typedefs[name]
+        (since, comment) = self.retrieve_comment_tags(name, id.extra)
+        version_tag = len(since) > 0 and f" version='{since}'" or ""
         if id.info[0:7] == 'struct ':
-            output.write("    <struct name='%s' file='%s' type='%s'" % (
-                name, self.modulename_file(id.header), id.info))
+            output.write("    <struct name='%s' file='%s' type='%s'%s" % (
+                name, self.modulename_file(id.header), id.info, version_tag))
             name = id.info[7:]
             if (name in self.idx.structs and
                     isinstance(self.idx.structs[name].info, (list, tuple))):
@@ -2323,12 +2325,11 @@ class docBuilder:
             else:
                 output.write("/>\n")
         else:
-            output.write("    <typedef name='%s' file='%s' type='%s'" % (
-                         name, self.modulename_file(id.header), id.info))
+            output.write("    <typedef name='%s' file='%s' type='%s'%s" % (
+                         name, self.modulename_file(id.header), id.info, version_tag))
             try:
-                desc = id.extra
-                if desc is not None and desc != "":
-                    output.write(">\n      <info><![CDATA[%s]]></info>\n" % (desc))
+                if comment is not None and comment != "":
+                    output.write(">\n      <info><![CDATA[%s]]></info>\n" % (comment))
                     output.write("    </typedef>\n")
                 else:
                     output.write("/>\n")
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux