From nobody Tue Feb 10 21:19:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1650655516; cv=none; d=zohomail.com; s=zohoarc; b=QSjJGM3NKAolaeGcsTFaTAIkacMlynffmpWajHmeSPVos06y+NQpUSBd9ShL5Z9ExKMfr/LRqGgRSX4E/6reqNlL5awgWk8Qttdr8jffIcsCPu+Npo9ilIkgH98ie6Qc/kUAmn0RvQYZooVXJk2PQDK25cjEyD/lScX6P8AnLGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650655516; 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=8Gr+tW4dr3h10ZLzHzxueWHOuJJjwwMzyfYOguN0+28=; b=kK7kFkrlM4z22GxzJylf5UYgtzVJjtoIPPO6T4qYAlPy6FDWAvbALr+sd67kdkgytfs7c7g8VL5ibm3i3dhrhLddCIstx69ia1B/FBXlWv5dIK7TEBoTDyDjDzYTQR4owUhtvyESeHNfXLCYxXV3ZorAWmWKBJDNiUkNLqzCqkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1650655516783292.30419041335153; Fri, 22 Apr 2022 12:25:16 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-154-OlJssyPGNM2IxJ92CxnBSg-1; Fri, 22 Apr 2022 15:25:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B592180075D; Fri, 22 Apr 2022 19:25:08 +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 57F8714A5066; Fri, 22 Apr 2022 19:25:08 +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 1A2181940355; Fri, 22 Apr 2022 19:25:08 +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 CDDD01940351 for ; Fri, 22 Apr 2022 19:25:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id ABF8A2024CC3; Fri, 22 Apr 2022 19:25:06 +0000 (UTC) Received: from tapioca.home (unknown [10.40.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 158262026614 for ; Fri, 22 Apr 2022 19:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650655515; 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=8Gr+tW4dr3h10ZLzHzxueWHOuJJjwwMzyfYOguN0+28=; b=WR4rotOyJ63v0wVpzeLnNLaJTNYnp+RhZtA//spOh4lKpKQJTLkGiXEjs+oDu5WkiJyb9R JwnSFOcSGMnvXjeEHqUsgATwq4QwVGCBAzgiQWWPBzSx0dl+JmX83wT2GnYEdbnDju2vHg gRK/sJD17xc9bXGgdA+KJrf9Ivs8Cuw= X-MC-Unique: OlJssyPGNM2IxJ92CxnBSg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Victor Toso To: libvir-list@redhat.com Subject: [PATCH v4 18/19] scripts: apibuild: factor out comment cleaning Date: Fri, 22 Apr 2022 21:23:43 +0200 Message-Id: <20220422192344.830350-19-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.7 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: 1650655517165100005 Content-Type: text/plain; charset="utf-8" So we can use for comments that are being hold in helper variables. Signed-off-by: Victor Toso --- scripts/apibuild.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index b86d20e364..40ee0a3c63 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -733,15 +733,18 @@ class CParser: line =3D line.replace('*', '', 1) return line =20 - def cleanupComment(self): - if not isinstance(self.comment, str): - return - # remove the leading * on multi-line comments - lines =3D self.comment.splitlines(True) + def cleanup_code_comment(self, comment: str) -> str: + if not isinstance(comment, str) or comment =3D=3D "": + return "" + + lines =3D comment.splitlines(True) com =3D "" for line in lines: com =3D com + self.strip_lead_star(line) - self.comment =3D com.strip() + return com.strip() + + def cleanupComment(self): + self.comment =3D self.cleanup_code_comment(self.comment) =20 def parseComment(self, token): com =3D token[1] --=20 2.35.1