* [gentoo-commits] proj/gentoolkit:master commit in: bin/, pym/gentoolkit/equery/
@ 2022-07-09 3:13 Brian Dolbec
0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2022-07-09 3:13 UTC (permalink / raw
To: gentoo-commits
commit: 71c6d4d94a5bd5aac3fb090e2e306c278a83b954
Author: Marco Sirabella <marco <AT> sirabella <DOT> org>
AuthorDate: Sat May 8 13:45:08 2021 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul 9 02:44:08 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=71c6d4d9
metadata.py: Don't fail on unmatched package
Added a warning hook too to reuse the GentoolkitNoMatches machinery
This allows users to do something like:
equery list @selected | xargs equery metadata
successfuly, even if there are some selected packages that don't exist
anymore.
Signed-off-by: Marco Sirabella <marco <AT> sirabella.org>
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
bin/equery | 10 ++++++++++
pym/gentoolkit/equery/meta.py | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/bin/equery b/bin/equery
index 0e52294..3b3e850 100755
--- a/bin/equery
+++ b/bin/equery
@@ -29,6 +29,16 @@ except KeyboardInterrupt:
sys.exit(1)
from gentoolkit import equery, errors
+import warnings
+
+
+def formatwarning(message, category, filename, llineno, line=None):
+ from gentoolkit import pprinter as pp
+ return pp.warn(str(message))
+
+
+if '--debug' not in sys.argv and not bool(os.getenv('DEBUG', False)):
+ warnings.formatwarning = formatwarning
try:
equery.main(sys.argv)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 4cf4bc6..2e8dc36 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -13,6 +13,7 @@ __docformat__ = "epytext"
import re
import os
import sys
+import warnings
from getopt import gnu_getopt, GetoptError
import gentoolkit.pprinter as pp
@@ -524,7 +525,8 @@ def main(input_args):
best_match = query.find_best()
matches = query.find(include_masked=True)
if best_match is None or not matches:
- raise errors.GentoolkitNoMatches(query)
+ warnings.warn(errors.GentoolkitNoMatches(query))
+ continue
if best_match.metadata is None:
print(
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-09 3:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-09 3:13 [gentoo-commits] proj/gentoolkit:master commit in: bin/, pym/gentoolkit/equery/ Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox