From nobody Thu Oct 31 00:22:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1722432192321406.46832726526327; Wed, 31 Jul 2024 06:23:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 522BD1410; Wed, 31 Jul 2024 09:23:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6A88613EC; Wed, 31 Jul 2024 09:21:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B6CC413A2; Wed, 31 Jul 2024 09:21:51 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5D45C143E for ; Wed, 31 Jul 2024 09:21:43 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-tdEfQ6a5Nl-9dzrBEOmhSw-1; Wed, 31 Jul 2024 09:21:40 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 499B21955F43 for ; Wed, 31 Jul 2024 13:21:39 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.70]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 002881955E80 for ; Wed, 31 Jul 2024 13:21:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722432102; h=from:from: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; bh=zo5Icjf1BUJotfDcWdf+lOoFQJgbj5mPhPLvb9Sh1lQ=; b=GP4nMMreeP/QpRlkms0u/CWCxyObcayvVsTj6ujONU4DpDGIMMdJFq6Nriq1H82SzFk0De neK2Dm4RroIqfsDCR4z4V82I6wYUBi8cD+fpoT7w7kqdDyDAgjmZJ9EYxNY2YCBWInPRf7 G9kzNH41BLQuhsc7e4ctjOEtIeJu6S0= X-MC-Unique: tdEfQ6a5Nl-9dzrBEOmhSw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCH 4/6] scripts: group-qemu-caps: separate file loading Date: Wed, 31 Jul 2024 15:20:50 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ER33KVFKUZPANPETWI3OOW2CBYUHPZHD X-Message-ID-Hash: ER33KVFKUZPANPETWI3OOW2CBYUHPZHD X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1722432193231116600 Content-Type: text/plain; charset="utf-8" Separate file loading from its parsing. Signed-off-by: J=C3=A1n Tomko --- scripts/group-qemu-caps.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/group-qemu-caps.py b/scripts/group-qemu-caps.py index 3581d1545a..a43cd1de45 100755 --- a/scripts/group-qemu-caps.py +++ b/scripts/group-qemu-caps.py @@ -27,8 +27,7 @@ import subprocess import sys =20 =20 -def load_caps_flags(filename, start_str, end_str): - capsflags =3D [] +def load_file(filename, start_str, end_str): lines =3D [] start =3D 0 end =3D 0 @@ -43,7 +42,13 @@ def load_caps_flags(filename, start_str, end_str): end =3D idx break =20 - for line in lines[start:end]: + return (lines, start, end) + + +def load_caps_flags(lines): + capsflags =3D [] + + for line in lines: if re.search(r'''.*/\* [0-9]+ \*/.*''', line): continue if re.search(r'''^\s*$''', line): @@ -135,9 +140,10 @@ args =3D parser.parse_args() =20 errs =3D False =20 -capsflags =3D load_caps_flags(args.prefix + 'src/qemu/qemu_capabilities.h', - 'virQEMUCapsFlags grouping marker', - 'QEMU_CAPS_LAST /* this must') +(header_lines, start, end) =3D load_file(args.prefix + 'src/qemu/qemu_capa= bilities.h', + 'virQEMUCapsFlags grouping marker', + 'QEMU_CAPS_LAST /* this must') +capsflags =3D load_caps_flags(header_lines[start:end]) =20 if not regroup_caps(args.check, args.prefix + 'src/qemu/qemu_capabilities.c', --=20 2.45.2