public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/scripts/
Date: Fri, 24 Nov 2023 15:17:29 +0000 (UTC)	[thread overview]
Message-ID: <1700839041.e3276db7fd78c3d7514d97aae24eabbb924a1ff1.arthurzam@gentoo> (raw)

commit:     e3276db7fd78c3d7514d97aae24eabbb924a1ff1
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Tue Nov 21 01:00:53 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <ferringb <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/415
Signed-off-by: Arthur Zamarin <arthurzam <AT> 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)))


             reply	other threads:[~2023-11-24 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 15:17 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-20 17:17 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/scripts/ Arthur Zamarin
2025-01-18 17:21 Arthur Zamarin
2025-01-15 20:02 Arthur Zamarin
2025-01-15 20:02 Arthur Zamarin
2023-11-24 15:17 Arthur Zamarin
2023-10-23 17:35 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-11-12 10:51 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1700839041.e3276db7fd78c3d7514d97aae24eabbb924a1ff1.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox