From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E1E97158099 for ; Fri, 24 Nov 2023 15:17:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 37D7F2BC0C7; Fri, 24 Nov 2023 15:17:32 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 22BF52BC0C7 for ; Fri, 24 Nov 2023 15:17:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6809233FD3F for ; Fri, 24 Nov 2023 15:17:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0009213C8 for ; Fri, 24 Nov 2023 15:17:29 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1700839041.e3276db7fd78c3d7514d97aae24eabbb924a1ff1.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/scripts/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/scripts/pquery.py X-VCS-Directories: src/pkgcore/scripts/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: e3276db7fd78c3d7514d97aae24eabbb924a1ff1 X-VCS-Branch: master Date: Fri, 24 Nov 2023 15:17:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3bd7ac69-7837-4cae-8b74-b7718eab9e94 X-Archives-Hash: 09cd695fc7d2144a01d2aa5be43a7797 commit: e3276db7fd78c3d7514d97aae24eabbb924a1ff1 Author: Brian Harring gmail com> AuthorDate: Tue Nov 21 01:00:53 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Fri Nov 24 15:17:21 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=e3276db7 pquery: Fix --environment-re support . This has been broken for a long while, thus I'm renaming it to `--environment-re` (from `--environment`) in the process. Tests will follow in a later PR (pquery test infra needs some work). Signed-off-by: Brian Harring gmail.com> Closes: https://github.com/pkgcore/pkgcore/pull/415 Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/scripts/pquery.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/pkgcore/scripts/pquery.py b/src/pkgcore/scripts/pquery.py index 0a01702fd..7211441fc 100644 --- a/src/pkgcore/scripts/pquery.py +++ b/src/pkgcore/scripts/pquery.py @@ -16,6 +16,7 @@ running them on source repos makes no sense. import errno import os from functools import partial +import typing from snakeoil.cli import arghparse from snakeoil.formatters import decorate_forced_wrapping @@ -35,9 +36,17 @@ from ..util import parserestrict class DataSourceRestriction(values.base): """Turn a data_source into a line iterator and apply a restriction.""" - def __init__(self, childrestriction, **kwargs): + __slots__ = ("negate", "restriction") + + def __init__( + self, + childrestriction: typing.Union[values.base, values.AnyMatch], + negate=False, + **kwargs, + ): super().__init__(**kwargs) - self.restriction = childrestriction + object.__setattr__(self, "restriction", childrestriction) + object.__setattr__(self, "negate", negate) def __str__(self): return f"DataSourceRestriction: {self.restriction} negate={self.negate}" @@ -929,9 +938,11 @@ def parse_maintainer_email(value): @bind_add_query( - "--environment", action="append", help="regexp search in environment.bz2" + "--environment-re", + action="append", + help="regexp search of lines in environment.bz2", ) -def parse_envmatch(value): +def parse_environment_re(value): """Apply a regexp to the environment.""" return packages.PackageRestriction( "environment", DataSourceRestriction(values.AnyMatch(values.StrRegex(value)))