From nobody Tue Feb 10 23:00:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650655505; cv=none; d=zohomail.com; s=zohoarc; b=GMIzrOHGHEGM7DkrFhyaeQdyRI6FbntCBA0u+vF9f3NwY73A2EDC1mnTY7RoXQ+giBigee6n/EJcO/D9yqmuB0iuWI47cGSoZKllsXUYegS/qQqMnRm3Y+pg4XU9U44kAwu+1fEeQ3RqFuwtmyBKYcpB4lO++AUqMDoh/keA9Eo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650655505; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V1eBfQyBYMum8UQPZkdaAzKAdXOTFYXwOC4cBqYz5Ow=; b=Y1pEaH8clVxhfmj7GKWI+vq96mY8MVAjTVt/EECWx654d36TMx35LjugU9tYjX98sJgPY1GQ6VUL/HOdtHbpFGVMJU148jXMa352QKnITcODKFQc8kLkEc7OA2r2+PRQLTDqizAkMJfx2LSNZIF6QItowhbGqTCv273BhdZDHvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1650655505715829.3698435766875; Fri, 22 Apr 2022 12:25:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-6F3jKW2QPXKiQUpx9PxVLQ-1; Fri, 22 Apr 2022 15:25:03 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5D0BC281AF3A; Fri, 22 Apr 2022 19:24:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4567841636F; Fri, 22 Apr 2022 19:24:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9097F194036C; Fri, 22 Apr 2022 19:24:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D23D81940351 for ; Fri, 22 Apr 2022 19:24:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B628B2024CC3; Fri, 22 Apr 2022 19:24:55 +0000 (UTC) Received: from tapioca.home (unknown [10.40.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 243212026614 for ; Fri, 22 Apr 2022 19:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650655504; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=V1eBfQyBYMum8UQPZkdaAzKAdXOTFYXwOC4cBqYz5Ow=; b=cBQtH/m9XGRjrc1rujwPO3FFsDLNblQpeillvUxRyS7GHebcMKkdwjR5pWD/mmy+z6StzI IBcfvhTk7izv8fWsDFHArHTd3nOvV8ocNX0yRroEcntKqp8ExisFskbK2VVOJAMCxU9mfK rFR1MrKjZDOgdTGgSNWFIP7+Gsj1wE4= X-MC-Unique: 6F3jKW2QPXKiQUpx9PxVLQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Victor Toso To: libvir-list@redhat.com Subject: [PATCH v4 13/19] scripts: apibuild: parse 'Since' version for enums Date: Fri, 22 Apr 2022 21:23:38 +0200 Message-Id: <20220422192344.830350-14-victortoso@redhat.com> In-Reply-To: <20220422192344.830350-1-victortoso@redhat.com> References: <20220422192344.830350-1-victortoso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650655507270100002 Content-Type: text/plain; charset="utf-8" This patch adds 'version' parameter to the generated XML API for enums. It'll require, for new additions, to add a comment with the version that the enum value was added. 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 Reviewed-by: Andrea Bolognani --- scripts/apibuild.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index bdd3077c48..19e897b1ba 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -2178,6 +2178,26 @@ class docBuilder: self.scanModules() self.scanVersions() =20 + # Fetch tags from the comment. Only 'Since' supported at the moment. + # Return the tags and the original comment without the tags. + def retrieve_comment_tags(self, name: str, comment: str + ) -> (str, str): + since =3D "" + if comment is not None: + comment_match =3D re.search(r"\(?Since: v?(\d+\.\d+\.\d+\.?\d?= )\)?", + comment) + if comment_match: + # Remove Since tag from the comment + (start, end) =3D comment_match.span() + comment =3D comment[:start] + comment[end:] + comment =3D comment.strip() + # Only the version + since =3D comment_match.group(1) + + if since =3D=3D "": + self.warning("Missing 'Since' tag for: " + name) + return (since, comment) + def modulename_file(self, file): module =3D os.path.basename(file) if module[-2:] =3D=3D '.h': @@ -2211,7 +2231,15 @@ class docBuilder: if info[2] is not None and info[2] !=3D '': output.write(" type=3D'%s'" % info[2]) if info[1] is not None and info[1] !=3D '': - output.write(" info=3D'%s'" % escape(info[1])) + # Search for 'Since' version tag + (since, comment) =3D self.retrieve_comment_tags(name, info= [1]) + if len(since) > 0: + output.write(" version=3D'%s'" % escape(since)) + if len(comment) > 0: + output.write(" info=3D'%s'" % escape(comment)) + else: + self.warning("Missing docstring for enum: " + name) + output.write("/>\n") =20 def serialize_macro(self, output, name): --=20 2.35.1