From nobody Mon Feb 9 00:20:30 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=1629815134; cv=none; d=zohomail.com; s=zohoarc; b=bd/0c7xwSOoB6b6mvCVkLWvq6TuD0U37qChsuQzov/9uqP9TkulhfdW6n8KtlFSOtKXZbt2llT7bjpjzTFngfnpfc7BpzHLtP7/CnVU4TzCVIaejKruDEYOSLzsBgsRcA+9EjhP2khr2k4XkgCdHQcfGHzwL23onaGPRunxp1dE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629815134; 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=3qI/l63qZCkQultz14eY9J3rcDen/ubn9Owq3poNaG0=; b=XKySOOvE7M2mKZzEN5JO3+Yc/Br4o3J9CagvFube/2StzIJ+GmC9Ty4DKvHtLjX6LmoaNnrsqa9obkbk/6OlLaZctZWwbcZE4sl18I8v2b+bGEzRwEfWRTN46nc+J35HL3EiQanABObNGVXaPRF8q/a1A5wYrUgtmEnXijb5fFo= 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 1629815134737867.8423954414222; Tue, 24 Aug 2021 07:25:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-05oOj-WlM5ec4KEViTlGLg-1; Tue, 24 Aug 2021 10:25:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F9721008073; Tue, 24 Aug 2021 14:25:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E7925D9C6; Tue, 24 Aug 2021 14:25:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0EAD4181A0F9; Tue, 24 Aug 2021 14:25:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEPN2x002874 for ; Tue, 24 Aug 2021 10:25:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 29C741ABDF; Tue, 24 Aug 2021 14:25:23 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6E175D6CF for ; Tue, 24 Aug 2021 14:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629815133; 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=3qI/l63qZCkQultz14eY9J3rcDen/ubn9Owq3poNaG0=; b=R/MIo3Ydqowu1AUgDxpSwwsECCI72bDW50kneQhQX/DqhdhwuvU/sc6VMz9dmLR5YefuCr kqcpjXXm0WK1y8pTHq1VOc1t4IYhZETEDY21i8vfy9K4B2KnBSMws/CtmAiGa9XERkyylr o0rqEecmyXJ3bWoAk8L1K1EeJ3Ovr/Q= X-MC-Unique: 05oOj-WlM5ec4KEViTlGLg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/11] scripts: group-qemu-caps: remove cryptic bool from load_caps_flags Date: Tue, 24 Aug 2021 16:25:06 +0200 Message-Id: <7f60ea005b3affe2ade06e78219dd0c258ce4aec.1629815074.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629815136908100001 Enumerate over lines early to find out the position of the starting and ending markers. Then run the actual function on the lines between those markers. Signed-off-by: J=C3=A1n Tomko --- scripts/group-qemu-caps.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/group-qemu-caps.py b/scripts/group-qemu-caps.py index bd22dd992a..e56c306d10 100755 --- a/scripts/group-qemu-caps.py +++ b/scripts/group-qemu-caps.py @@ -29,27 +29,29 @@ import sys =20 def load_caps_flags(filename, start_regex, end_regex): capsflags =3D [] - game_on =3D False lines =3D [] + start =3D 0 + end =3D 0 =20 with open(filename, "r") as fh: lines =3D fh.read().splitlines() =20 - for line in lines: - if game_on: - if re.search(r'''.*/\* [0-9]+ \*/.*''', line): - continue - if re.search(r'''^\s*$''', line): - continue - match =3D re.search(r'''[ ]+([A-Z0-9_]+)''', line) - - if match: - capsflags.append(match[1]) - + for idx, line in enumerate(lines): if re.search(start_regex, line): - game_on =3D True - elif game_on and re.search(end_regex, line): - game_on =3D False + start =3D idx + elif re.search(end_regex, line): + end =3D idx + break + + for line in lines[start:end]: + if re.search(r'''.*/\* [0-9]+ \*/.*''', line): + continue + if re.search(r'''^\s*$''', line): + continue + match =3D re.search(r'''[ ]+([A-Z0-9_]+)''', line) + + if match: + capsflags.append(match[1]) =20 return capsflags =20 --=20 2.31.1