From nobody Tue Feb 10 12:40:14 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=1650481749; cv=none; d=zohomail.com; s=zohoarc; b=B+znDDCaWr4Th6bRffnExJBY8Fi0V2DeGTuraAT7JKoxCF7fye90OntNFRCxPrihJPeZYXQH1xv3m9Ed2T7ogUyYouUU3IJQJ2arHcYjqHME45AE7kWofTdahAM7inkSOvLb0hOSKZQdpcSARPuR5GiHh3P1h4nZ0VKeOSysCcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650481749; 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=TX3+ANkmEV98xadRy3JmNZdH2arEc3xDyvm9d0R3j8o=; b=k286ED/S8AXUzelwf3AKkR2dMh7pjnc26etSKeyWIwlCcSaTUSxExL9WZs6WK/Gsd1zQu+ZY1p4IuxAqHh6Rzgo9SBQb/QdMpeIXAJZgFnBVh/HqMB4iFz9X7X/nuVoHCz9rPShetxbhmMWs0wv9Q87nbKD/8V1QVz6kRNkGj/o= 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 1650481749399257.72742632610493; Wed, 20 Apr 2022 12:09:09 -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-553-q6C7ErdYMfGy9YhLUF1W5w-1; Wed, 20 Apr 2022 15:09:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CBB9F3C172CA; Wed, 20 Apr 2022 19:08:55 +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 B40D140D0166; Wed, 20 Apr 2022 19:08:55 +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 8E7F51940353; Wed, 20 Apr 2022 19:08:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B86611940361 for ; Wed, 20 Apr 2022 19:08:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 808EC551E82; Wed, 20 Apr 2022 19:08:50 +0000 (UTC) Received: from tapioca.home (unknown [10.40.193.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E42F551E85 for ; Wed, 20 Apr 2022 19:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650481748; 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=TX3+ANkmEV98xadRy3JmNZdH2arEc3xDyvm9d0R3j8o=; b=D37UsWYs03xbF9l5nB48FaKYYlitfeDDD0KN5Kdgnslb+EDDE6DAU6qCe8M8x1eyaN8ybT AZefltWFiDmzUO9XortAbNhjovTpvCUG8y5TPMYemDsXQYuf5hM/cLd61HJ19XovpI20V5 Bn/RjJHR7+aB9ufxQ8rAtkcPk9U0GDg= X-MC-Unique: q6C7ErdYMfGy9YhLUF1W5w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Victor Toso To: libvir-list@redhat.com Subject: [PATCH v3 28/30] scripts: apibuild: factor out comment cleaning Date: Wed, 20 Apr 2022 21:08:17 +0200 Message-Id: <20220420190819.3093205-29-victortoso@redhat.com> In-Reply-To: <20220420190819.3093205-1-victortoso@redhat.com> References: <20220420190819.3093205-1-victortoso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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.84 on 10.11.54.1 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: 1650481750224100023 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 ec10931151..151eba37e6 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -789,15 +789,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(self.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