* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2015-11-08 17:37 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2015-11-08 17:37 UTC (permalink / raw
To: gentoo-commits
commit: 8f226fd87cc96c997a6be5adb29ed6e6787d0791
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 8 17:15:03 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Nov 8 17:36:27 2015 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=8f226fd8
equery/meta.py: Fix a traceback reported by Manuel Rueger
equery m python-whiteboard
* x11-apps/python-whiteboard [gentoo]
Herd: proxy-maintainers (proxy-maint <AT> gentoo.org)
Maintainer: lxnay <AT> gentoo.org (Fabio Erculiani)
Maintainer. Assign bugs to him
Maintainer: ziapannocchia <AT> gmail.com (Marco Clocchiatti)
Proxy maintainer. CC him on bugs
Traceback (most recent call last):
File "/usr/lib/python-exec/python2.7/equery", line 38, in <module>
equery.main(sys.argv)
File "/usr/lib64/python2.7/site-packages/gentoolkit/equery/__init__.py", line 357, in main
loaded_module.main(module_args)
File "/usr/lib64/python2.7/site-packages/gentoolkit/equery/meta.py", line 567, in main
call_format_functions(best_match, matches)
File "/usr/lib64/python2.7/site-packages/gentoolkit/equery/meta.py", line 338, in call_format_functions
upstream = format_upstream(best_match.metadata.upstream())
File "/usr/lib64/python2.7/site-packages/gentoolkit/equery/meta.py", line 220, in format_upstream
upmaints = format_maintainers(up.maintainers)
File "/usr/lib64/python2.7/site-packages/gentoolkit/equery/meta.py", line 185, in format_maintainers
maintstr += " (%s)" % (maint.name,) if maint.name else ''
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/meta.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index d3342cd..1a07999 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -179,14 +179,11 @@ def format_maintainers(maints):
result = []
for maint in maints:
- maintstr = ''
- maintstr = maint.email
+ maintstr = maint.email or ''
if CONFIG['verbose']:
- maintstr += " (%s)" % (maint.name,) if maint.name else ''
- maintstr += " - %s" % (maint.restrict,) if maint.restrict else ''
- maintstr += "\n%s" % (
- (maint.description,) if maint.description else ''
- )
+ maintstr += " (%s)" % (maint.name or'')
+ maintstr += " - %s" % (maint.restrict or '')
+ maintstr += "\n%s" % (maint.description or '')
result.append(maintstr)
return result
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2015-11-09 2:42 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2015-11-09 2:42 UTC (permalink / raw
To: gentoo-commits
commit: ddb7cf01f01d7175cdab348b9d94b0994695e337
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 9 02:37:15 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Nov 9 02:37:15 2015 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ddb7cf01
equery/meta.py: Revert the changes to the verbose section or format_maintainers
The last change would always print the first string even if the maint attribute was None.
This was due to the string always being non-empty.
The original code there was correct.
It was only the maint.email assignment that was in error.
pym/gentoolkit/equery/meta.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 1a07999..8af5744 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -181,9 +181,9 @@ def format_maintainers(maints):
for maint in maints:
maintstr = maint.email or ''
if CONFIG['verbose']:
- maintstr += " (%s)" % (maint.name or'')
- maintstr += " - %s" % (maint.restrict or '')
- maintstr += "\n%s" % (maint.description or '')
+ maintstr += " (%s)" % (maint.name) if maint.name else ''
+ maintstr += " - %s" % (maint.restrict) if maint.restrict else ''
+ maintstr += "\n%s" % (maint.description) if maint.description else ''
result.append(maintstr)
return result
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2015-11-09 20:52 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2015-11-09 20:52 UTC (permalink / raw
To: gentoo-commits
commit: 62c9856745e5b6de230d4ede5e8d7e9ff226ff73
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 9 20:51:37 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Nov 9 20:51:37 2015 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=62c98567
equery/meta.py: Re-add the coma, so it makes the data a true tuple.
As pointed out by Arfrever Frehtes Taifersar Arahesis, this prides protection in that if the
variable's data is a tuple. The conversion will still happen correctly.
pym/gentoolkit/equery/meta.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 8af5744..ea1c96a 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -181,9 +181,9 @@ def format_maintainers(maints):
for maint in maints:
maintstr = maint.email or ''
if CONFIG['verbose']:
- maintstr += " (%s)" % (maint.name) if maint.name else ''
- maintstr += " - %s" % (maint.restrict) if maint.restrict else ''
- maintstr += "\n%s" % (maint.description) if maint.description else ''
+ maintstr += " (%s)" % (maint.name,) if maint.name else ''
+ maintstr += " - %s" % (maint.restrict,) if maint.restrict else ''
+ maintstr += "\n%s" % (maint.description,) if maint.description else ''
result.append(maintstr)
return result
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2016-06-06 19:29 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2016-06-06 19:29 UTC (permalink / raw
To: gentoo-commits
commit: b502f01a5906602abf08e08c7a5d948518df055a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 6 15:29:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jun 6 15:29:33 2016 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b502f01a
equery.depends.py: Apply subslot patch from bug 576060
Author: Jelte Fennema <gentoobugzilla <AT> jeltef.nl>
X-Gentoo-bug: 576060
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=576060
pym/gentoolkit/equery/depends.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 9e5d8de..93c2137 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -91,6 +91,8 @@ class DependPrinter(object):
formatted_dep = mdep.operator + str(mdep.cpv)
if mdep.slot:
formatted_dep += pp.emph(':') + pp.slot(mdep.slot)
+ if mdep.sub_slot:
+ formatted_dep += pp.slot('/') + pp.slot(mdep.sub_slot)
if mdep.use:
useflags = pp.useflag(','.join(mdep.use.tokens))
formatted_dep += (pp.emph('[') + useflags + pp.emph(']'))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2016-06-30 20:44 Paul Varner
0 siblings, 0 replies; 22+ messages in thread
From: Paul Varner @ 2016-06-30 20:44 UTC (permalink / raw
To: gentoo-commits
commit: b72e032ea252757c4309516c865fafaf7354036b
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 30 20:39:24 2016 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 20:39:24 2016 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b72e032e
equery: Fix UnicodeDecodeError in python2.7
This fix explicitly decodes the content of the USE description files as
UTF-8. This fixes the UnicodeDecodeError in Python 2.7. Tested with a
POSIX locale with Python 2.7, 3.4 and 3.5.
X-Gentoo-bug: 587606
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=587606
pym/gentoolkit/equery/uses.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
index 79ed00f..adf8b6c 100644
--- a/pym/gentoolkit/equery/uses.py
+++ b/pym/gentoolkit/equery/uses.py
@@ -138,6 +138,7 @@ def get_global_useflags():
path = os.path.join(settings["PORTDIR"], 'profiles', 'use.desc')
with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file:
for line in open_file:
+ line = _unicode_decode(line)
if line.startswith('#'):
continue
# Ex. of fields: ['syslog', 'Enables support for syslog\n']
@@ -158,6 +159,7 @@ def get_global_useflags():
try:
with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file:
for line in open_file:
+ line = _unicode_decode(line)
if line.startswith('#'):
continue
fields = [field.strip() for field in line.split(" - ", 1)]
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2016-06-30 23:36 Paul Varner
0 siblings, 0 replies; 22+ messages in thread
From: Paul Varner @ 2016-06-30 23:36 UTC (permalink / raw
To: gentoo-commits
commit: fa12fe254733ca3e6edf5659522da7e048f53adc
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 30 21:06:00 2016 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 21:19:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=fa12fe25
equery: Change option --ignore-linguas to --ignore-l10n
Change the option to filter out the L10N USE expanded flag. This is to
support the transition from using LINGUAS for localization in ebuilds.
pym/gentoolkit/equery/uses.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
index adf8b6c..79f1118 100644
--- a/pym/gentoolkit/equery/uses.py
+++ b/pym/gentoolkit/equery/uses.py
@@ -35,7 +35,7 @@ from gentoolkit.flag import get_flags, reduce_flags
# Globals
# =======
-QUERY_OPTS = {"all_versions" : False, "ignore_linguas" : False}
+QUERY_OPTS = {"all_versions" : False, "ignore_l10n" : False}
# =========
# Functions
@@ -57,7 +57,7 @@ def print_help(with_description=True):
print(format_options((
(" -h, --help", "display this help message"),
(" -a, --all", "include all package versions"),
- (" -i, --ignore-linguas", "don't show linguas USE flags")
+ (" -i, --ignore-l10n", "don't show l10n USE flags")
)))
@@ -187,9 +187,10 @@ def get_output_descriptions(pkg, global_usedesc):
usevar = reduce_flags(iuse)
usevar.sort()
- if QUERY_OPTS['ignore_linguas']:
+ if QUERY_OPTS['ignore_l10n']:
for a in usevar[:]:
- if a.startswith("linguas_"):
+ #TODO: Remove linguas after transition to l10n is complete
+ if a.startswith("l10n_") or a.startswith("linguas_"):
usevar.remove(a)
@@ -244,8 +245,8 @@ def parse_module_options(module_opts):
sys.exit(0)
elif opt in ('-a', '--all'):
QUERY_OPTS['all_versions'] = True
- elif opt in ('-i', '--ignore-linguas'):
- QUERY_OPTS['ignore_linguas'] = True
+ elif opt in ('-i', '--ignore-l10n'):
+ QUERY_OPTS['ignore_l10n'] = True
def print_legend():
@@ -261,7 +262,7 @@ def main(input_args):
"""Parse input and run the program"""
short_opts = "hai"
- long_opts = ('help', 'all', 'ignore-linguas')
+ long_opts = ('help', 'all', 'ignore-l10n')
try:
module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2017-09-05 15:32 Mike Gilbert
0 siblings, 0 replies; 22+ messages in thread
From: Mike Gilbert @ 2017-09-05 15:32 UTC (permalink / raw
To: gentoo-commits
commit: 83b757c0b7bcf1912eb1acabdfbb3f5a5f46cd17
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue May 23 22:46:32 2017 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue May 23 22:49:07 2017 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=83b757c0
equery: check: use os.path.lexists()
os.path.exists() returns false on broken symlinks. We don't actually
care if the symlink target exists.
X-Gentoo-Bug: 619472
X-Gentoo-Bug-URL: https://bugs.gentoo.org/619472
pym/gentoolkit/equery/check.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py
index 77042f8..d5a22a3 100644
--- a/pym/gentoolkit/equery/check.py
+++ b/pym/gentoolkit/equery/check.py
@@ -106,7 +106,7 @@ class VerifyContents(object):
n_checked += 1
ftype = files[cfile][0]
real_cfile = os.environ.get('ROOT', '') + cfile
- if not os.path.exists(real_cfile):
+ if not os.path.lexists(real_cfile):
errs.append("%s does not exist" % cfile)
continue
elif ftype == "dir":
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2018-05-01 12:32 Mike Pagano
0 siblings, 0 replies; 22+ messages in thread
From: Mike Pagano @ 2018-05-01 12:32 UTC (permalink / raw
To: gentoo-commits
commit: bb585671418fa51682a7e1dbfef5914e26261adf
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Tue May 1 12:30:13 2018 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Tue May 1 12:30:13 2018 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bb585671
epkginfo: Add 'reverse' display option for equery
This adds a small convenience for displaying the ebuilds in reverse
order. This helps people prune packages that grow quickly as the
most relevant ones are at the top.
pym/gentoolkit/equery/meta.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index ea1c96a..e9f5cea 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -89,6 +89,7 @@ def print_help(with_description=True, with_usage=True):
(" -k, --keywords", "show keywords for all matching package versions"),
(" -l, --license", "show licenses for the best maching version"),
(" -m, --maintainer", "show the maintainer(s) for the package"),
+ (" -r, --reverse", "show the output in reverse order if applicable"),
(" -S, --stablreq", "show STABLEREQ arches (cc's) for all matching package versions"),
(" -u, --useflags", "show per-package USE flag descriptions"),
(" -U, --upstream", "show package's upstream information"),
@@ -525,9 +526,9 @@ def parse_module_options(module_opts):
def main(input_args):
"""Parse input and run the program."""
- short_opts = "hdHklmSuUx"
+ short_opts = "hdHklmrSuUx"
long_opts = ('help', 'description', 'herd', 'keywords', 'license',
- 'maintainer', 'stablereq', 'useflags', 'upstream', 'xml')
+ 'maintainer', 'reverse', 'stablereq', 'useflags', 'upstream', 'xml')
try:
module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)
@@ -561,6 +562,8 @@ def main(input_args):
print()
matches.sort()
+ matches.sort(reverse=any(name in ('-r', '--reverse')
+ for name, opt in module_opts))
call_format_functions(best_match, matches)
first_run = False
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-09 5:17 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2022-07-09 5:17 UTC (permalink / raw
To: gentoo-commits
commit: 3851c6ea2fe93ee1d190adc13f3cfaef0901c982
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 9 05:17:34 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 9 05:17:34 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3851c6ea
equery: run black
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/depends.py | 47 ++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 93f0ec1..f65e846 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -19,6 +19,7 @@ from gentoolkit.equery import format_options, mod_usage, CONFIG
from gentoolkit.helpers import get_cpvs, get_installed_cpvs
from gentoolkit.cpv import CPV
from gentoolkit.package import PackageFormatter, FORMAT_TMPL_VARS
+
# =======
# Globals
# =======
@@ -69,18 +70,18 @@ class DependPrinter:
if pkg is None:
return
- if CONFIG['verbose']:
- print (PackageFormatter(
- pkg,
- do_format=True,
- custom_format=QUERY_OPTS["package_format"]
- ))
+ if CONFIG["verbose"]:
+ print(
+ PackageFormatter(
+ pkg, do_format=True, custom_format=QUERY_OPTS["package_format"]
+ )
+ )
else:
- print (PackageFormatter(
- pkg,
- do_format=False,
- custom_format=QUERY_OPTS["package_format"]
- ))
+ print(
+ PackageFormatter(
+ pkg, do_format=False, custom_format=QUERY_OPTS["package_format"]
+ )
+ )
def format_depend(self, dep, dep_is_displayed):
"""Format a dependency for printing.
@@ -107,24 +108,23 @@ class DependPrinter:
use_conditional = " & ".join(
pp.useflag(u) for u in mdep.use_conditional.split()
)
- if mdep.operator == '=*':
- formatted_dep = '=%s*' % str(mdep.cpv)
+ if mdep.operator == "=*":
+ formatted_dep = "=%s*" % str(mdep.cpv)
else:
formatted_dep = mdep.operator + str(mdep.cpv)
if mdep.slot:
- formatted_dep += pp.emph(':') + pp.slot(mdep.slot)
+ formatted_dep += pp.emph(":") + pp.slot(mdep.slot)
if mdep.sub_slot:
- formatted_dep += pp.slot('/') + pp.slot(mdep.sub_slot)
+ formatted_dep += pp.slot("/") + pp.slot(mdep.sub_slot)
if mdep.use:
- useflags = pp.useflag(','.join(mdep.use.tokens))
- formatted_dep += (pp.emph('[') + useflags + pp.emph(']'))
+ useflags = pp.useflag(",".join(mdep.use.tokens))
+ formatted_dep += pp.emph("[") + useflags + pp.emph("]")
if dep_is_displayed:
indent = indent + " " * len(str(dep.cpv))
- self.print_fn(indent, '', use_conditional, formatted_dep)
+ self.print_fn(indent, "", use_conditional, formatted_dep)
else:
- self.print_fn(indent, \
- str(dep.cpv), use_conditional, formatted_dep)
+ self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep)
# =========
@@ -174,7 +174,7 @@ def parse_module_options(module_opts):
QUERY_OPTS["include_masked"] = True
elif opt in ("-D", "--indirect"):
QUERY_OPTS["only_direct"] = False
- elif opt in ('-F', '--format'):
+ elif opt in ("-F", "--format"):
QUERY_OPTS["package_format"] = posarg
elif opt in ("--depth"):
if posarg.isdigit():
@@ -190,9 +190,8 @@ def parse_module_options(module_opts):
def main(input_args):
"""Parse input and run the program"""
- short_opts = "hadDF:" # -d, --direct was old option for default action
- long_opts = ('help', 'all-packages', 'direct', 'indirect', \
- 'format', 'depth=')
+ short_opts = "hadDF:" # -d, --direct was old option for default action
+ long_opts = ("help", "all-packages", "direct", "indirect", "format", "depth=")
try:
module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-10 1:24 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-10 1:24 UTC (permalink / raw
To: gentoo-commits
commit: 84ffe42e52d06fd90a21c93d60dbec7c64b621cf
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 01:06:50 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 01:06:50 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84ffe42e
equery: Turn off color when piping is set
Bug: https://bugs.gentoo.org/506394
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py
index cecb5be..56b2caa 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -228,6 +228,8 @@ def initialize_configuration():
# set extra wide, should disable wrapping unless
# there is some extra long text
CONFIG["termWidth"] = 600
+ # turn off color
+ pp.output.nocolor()
CONFIG["debug"] = bool(os.getenv("DEBUG", False))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-10 16:23 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-10 16:23 UTC (permalink / raw
To: gentoo-commits
commit: c1c66b84d3e14b887b7b460111664e62238172fb
Author: Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Sun Jul 10 15:55:25 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 15:55:25 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c1c66b84
equery check: Fix exception handling for Insufficient permissions
A quick look into the source reveals that there is actually code to handle the case,
but it expects the wrong exception type.
This patch fixes that and also avoids a crash for other errors.
Bug: https://bugs.gentoo.org/494134
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/check.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py
index 7a7c3db..7e580b1 100644
--- a/pym/gentoolkit/equery/check.py
+++ b/pym/gentoolkit/equery/check.py
@@ -16,6 +16,7 @@ from functools import partial
from getopt import gnu_getopt, GetoptError
import portage.checksum as checksum
+from portage.exception import PermissionDenied
import gentoolkit.pprinter as pp
from gentoolkit import errors
@@ -138,10 +139,14 @@ class VerifyContents:
md5sum = files[cfile][2]
try:
cur_checksum = checksum.perform_md5(real_cfile, calc_prelink=1)
- except IOError:
+ except PermissionDenied:
err = "Insufficient permissions to read %(cfile)s"
obj_errs.append(err % locals())
return obj_errs
+ except Exception as ex:
+ err = "Problem checking %(cfile)s: %(ex)s"
+ obj_errs.append(err % locals())
+ return obj_errs
if cur_checksum != md5sum:
err = "%(cfile)s has incorrect MD5sum"
obj_errs.append(err % locals())
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-10 16:23 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-10 16:23 UTC (permalink / raw
To: gentoo-commits
commit: 9b9711bf1b1111d0bdc24e4be6fc226758738d7a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 16:16:40 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 16:16:40 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9b9711bf
equery depends: Fix a traceback due to UnboundLocalError:
File "/home/brian/Dev/git/gentoolkit/pym/gentoolkit/equery/depends.py"
, line 106, in format_depend
self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep)
UnboundLocalError: local variable 'formatted_dep' referenced before
assignment
The statement appears to be added as preliminary debug info.
Removed it.
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/depends.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index f65e846..fe56148 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -103,7 +103,6 @@ class DependPrinter:
pkg = Package(str(dep.cpv))
self.print_formated(pkg)
else:
- self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep)
if mdep.use_conditional:
use_conditional = " & ".join(
pp.useflag(u) for u in mdep.use_conditional.split()
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-10 18:01 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-10 18:01 UTC (permalink / raw
To: gentoo-commits
commit: d755f0f7c8e6b21f926837d46440768d58281b04
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 17:58:42 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 17:58:42 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d755f0f7
depends.py: Fix 3e35553df46 missing Package import
Remove unused FORMAT_TMPL_VARS import
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/depends.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index fe56148..8ec5f75 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -18,7 +18,7 @@ from gentoolkit.dependencies import Dependencies
from gentoolkit.equery import format_options, mod_usage, CONFIG
from gentoolkit.helpers import get_cpvs, get_installed_cpvs
from gentoolkit.cpv import CPV
-from gentoolkit.package import PackageFormatter, FORMAT_TMPL_VARS
+from gentoolkit.package import PackageFormatter, Package
# =======
# Globals
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-10 18:41 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-10 18:41 UTC (permalink / raw
To: gentoo-commits
commit: 68159035c6479e313c33dd31d19d42d3178f1235
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 18:25:18 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 18:25:18 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=68159035
equery check.py: Fix flake 8 qa for unused variable
flake8 did not correctly detect the way the variable is used.
Add an assert to eliminate the false detection.
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/check.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py
index 7e580b1..2ef881c 100644
--- a/pym/gentoolkit/equery/check.py
+++ b/pym/gentoolkit/equery/check.py
@@ -144,6 +144,7 @@ class VerifyContents:
obj_errs.append(err % locals())
return obj_errs
except Exception as ex:
+ assert ex # to silence unused variable ex
err = "Problem checking %(cfile)s: %(ex)s"
obj_errs.append(err % locals())
return obj_errs
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-28 15:29 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-28 15:29 UTC (permalink / raw
To: gentoo-commits
commit: 91721fcdb85ff67f7607dad60e82f11c1bf701fd
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 01:37:37 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 01:37:37 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=91721fcd
equery meta: Put maintainer description on the same line
Bug: https://bugs.gentoo.org/576224
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/meta.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 124f59b..22e9ad8 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -167,7 +167,7 @@ def format_maintainers(maints):
if CONFIG["verbose"]:
maintstr += " (%s)" % (maint.name,) if maint.name else ""
maintstr += " - %s" % (maint.restrict,) if maint.restrict else ""
- maintstr += "\n%s" % (maint.description,) if maint.description else ""
+ maintstr += " - %s" % (maint.description,) if maint.description else ""
result.append(maintstr)
return result
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2022-07-28 15:29 Brian Dolbec
0 siblings, 0 replies; 22+ messages in thread
From: Brian Dolbec @ 2022-07-28 15:29 UTC (permalink / raw
To: gentoo-commits
commit: 9a402fba0d63240685a2326926060c3c8c523101
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 15:22:55 2022 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 15:22:55 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9a402fba
equery: Set nocolor for piping to after options are parsed
Fixes commit 84ffe42e5 which set nocolor before options were parsed.
Bug: https://bugs.gentoo.org/861116
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/equery/__init__.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py
index 56b2caa..ae760c1 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -228,8 +228,6 @@ def initialize_configuration():
# set extra wide, should disable wrapping unless
# there is some extra long text
CONFIG["termWidth"] = 600
- # turn off color
- pp.output.nocolor()
CONFIG["debug"] = bool(os.getenv("DEBUG", False))
@@ -338,6 +336,10 @@ def main(argv):
else:
CONFIG["verbose"] = True
+ if CONFIG["piping"]:
+ # turn off color
+ pp.output.nocolor()
+
try:
module_name, module_args = split_arguments(args)
except IndexError:
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2023-07-18 22:26 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2023-07-18 22:26 UTC (permalink / raw
To: gentoo-commits
commit: 9eeff3399b23df1e4eed6f782e77c28b30347c9a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 18 22:26:33 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 18 22:26:50 2023 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9eeff339
equery: depgraph: Fix --linear shortopt (-l)
Closes: https://bugs.gentoo.org/709816
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/depgraph.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pym/gentoolkit/equery/depgraph.py b/pym/gentoolkit/equery/depgraph.py
index 9003a47..d9e3901 100644
--- a/pym/gentoolkit/equery/depgraph.py
+++ b/pym/gentoolkit/equery/depgraph.py
@@ -197,7 +197,7 @@ def main(input_args):
"""Parse input and run the program"""
short_opts = "hAMUl"
- long_opts = ("help", "no-atom", "no-useflags", "no-mask", "depth=")
+ long_opts = ("help", "no-atom", "no-useflags", "no-mask", "depth=", "linear")
try:
module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2023-07-18 22:30 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2023-07-18 22:30 UTC (permalink / raw
To: gentoo-commits
commit: 637bfbfb27d2104a81d80e5c67a7878d2e874966
Author: Rafał Mużyło <galtgendo <AT> o2 <DOT> pl>
AuthorDate: Tue Jul 18 22:28:44 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 18 22:28:44 2023 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=637bfbfb
equery: list: correctly handle installed packages no longer in tree
Closes: https://bugs.gentoo.org/369581
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/list_.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/gentoolkit/equery/list_.py b/pym/gentoolkit/equery/list_.py
index 1e03d91..9b38c3e 100644
--- a/pym/gentoolkit/equery/list_.py
+++ b/pym/gentoolkit/equery/list_.py
@@ -233,10 +233,10 @@ def main(input_args):
)
if QUERY_OPTS["in_porttree"] and not QUERY_OPTS["in_overlay"]:
- if not "P" in pkgstr.location:
+ if not ("P" in pkgstr.location or (QUERY_OPTS['in_installed'] and 'I' in pkgstr.location)):
continue
if QUERY_OPTS["in_overlay"] and not QUERY_OPTS["in_porttree"]:
- if not "O" in pkgstr.location:
+ if not ("O" in pkgstr.location or (QUERY_OPTS['in_installed'] and 'I' in pkgstr.location)):
continue
pp.uprint(pkgstr)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2023-08-05 5:38 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2023-08-05 5:38 UTC (permalink / raw
To: gentoo-commits
commit: 9fbd05c05f86bb9c67d229ea64fe72c5ea08cf62
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 5 05:38:40 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 5 05:38:45 2023 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9fbd05c0
equery: reformat with black
Fixes: 637bfbfb27d2104a81d80e5c67a7878d2e874966
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/list_.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pym/gentoolkit/equery/list_.py b/pym/gentoolkit/equery/list_.py
index 9b38c3e..237e7fe 100644
--- a/pym/gentoolkit/equery/list_.py
+++ b/pym/gentoolkit/equery/list_.py
@@ -233,10 +233,16 @@ def main(input_args):
)
if QUERY_OPTS["in_porttree"] and not QUERY_OPTS["in_overlay"]:
- if not ("P" in pkgstr.location or (QUERY_OPTS['in_installed'] and 'I' in pkgstr.location)):
+ if not (
+ "P" in pkgstr.location
+ or (QUERY_OPTS["in_installed"] and "I" in pkgstr.location)
+ ):
continue
if QUERY_OPTS["in_overlay"] and not QUERY_OPTS["in_porttree"]:
- if not ("O" in pkgstr.location or (QUERY_OPTS['in_installed'] and 'I' in pkgstr.location)):
+ if not (
+ "O" in pkgstr.location
+ or (QUERY_OPTS["in_installed"] and "I" in pkgstr.location)
+ ):
continue
pp.uprint(pkgstr)
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2023-09-19 19:13 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2023-09-19 19:13 UTC (permalink / raw
To: gentoo-commits
commit: 5146d35eb97e2c1a8f7691e59c755ed14e858dd4
Author: Siddhanth Rathod <xsiddhanthrathod <AT> gmail <DOT> com>
AuthorDate: Tue Sep 19 18:31:49 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 19:13:02 2023 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5146d35e
equery meta: map the remote-id to the respective url
Bug: https://bugs.gentoo.org/877519
Signed-off-by: Siddhanth Rathod <xsiddhanthrathod <AT> gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/32
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/meta.py | 51 ++++++++++++++++++++++++++++++++++---------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 02b6f67..de5631b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -10,19 +10,19 @@ __docformat__ = "epytext"
# Imports
# =======
-import re
import os
+import re
import sys
import warnings
-from getopt import gnu_getopt, GetoptError
+from getopt import GetoptError, gnu_getopt
import gentoolkit.pprinter as pp
from gentoolkit import errors
+from gentoolkit.equery import CONFIG, format_options, mod_usage
+from gentoolkit.helpers import print_file, print_sequence
from gentoolkit.keyword import Keyword
-from gentoolkit.equery import format_options, mod_usage, CONFIG
-from gentoolkit.helpers import print_sequence, print_file
-from gentoolkit.textwrap_ import TextWrapper
from gentoolkit.query import Query
+from gentoolkit.textwrap_ import TextWrapper
# =======
# Globals
@@ -189,11 +189,42 @@ def format_upstream(upstream):
def _format_upstream_ids(ids):
result = []
- for id_ in ids:
- site = id_[0]
- proj_id = id_[1]
- idstr = f"{site} ID: {proj_id}"
- result.append(idstr)
+ remote_ids = {
+ "github": "https://github.com/remote-id",
+ "gentoo": "https://gitweb.gentoo.org/remote-id.git/",
+ "bitbucket": "https://bitbucket.org/remote-id",
+ "codeberg": "https://codeberg.org/remote-id",
+ "cpan": "https://metacpan.org/dist/remote-id",
+ "cpan-module": "https://metacpan.org/pod/remote-id",
+ "cpe": "remote-id",
+ "cran": "https://cran.r-project.org/web/packages/remote-id/",
+ "ctan": "https://ctan.org/pkg/remote-id",
+ "freedesktop-gitlab": "https://gitlab.freedesktop.org/remote-id.git/",
+ "gitlab": "https://gitlab.com/remote-id",
+ "gnome-gitlab": "https://gitlab.gnome.org/remote-id.git/",
+ "google-code": "https://code.google.com/archive/p/remote-id/",
+ "hackage": "https://hackage.haskell.org/package/remote-id",
+ "heptapod": "https://foss.heptapod.net/remote-id",
+ "kde-invent": "https://invent.kde.org/remote-id",
+ "launchpad": "https://launchpad.net/remote-id",
+ "osdn": "https://osdn.net/projects/remote-id/",
+ "pear": "https://pear.php.net/package/remote-id",
+ "pecl": "https://pecl.php.net/package/remote-id",
+ "pypi": "https://pypi.org/project/remote-id/",
+ "rubygems": "https://rubygems.org/gems/remote-id/",
+ "savannah": "https://savannah.gnu.org/projects/remote-id",
+ "savannah-nongnu": "https://savannah.nongnu.org/projects/remote-id",
+ "sourceforge": "https://sourceforge.net/projects/remote-id/",
+ "sourcehut": "https://sr.ht/remote-id/",
+ "vim": "https://www.vim.org/scripts/script.php?script_id=remote-id",
+ }
+ for id in ids:
+ proj_id = id[1]
+ try:
+ site = remote_ids[proj_id].replace("remote-id", id[0])
+ except KeyError:
+ site = id[0]
+ result.append(f"{site} ({proj_id})")
return result
result = []
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2024-03-07 18:49 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2024-03-07 18:49 UTC (permalink / raw
To: gentoo-commits
commit: b9294a02b804f0286f22625d563a1f92a1bb24b3
Author: John Turner <jturner.usa <AT> gmail <DOT> com>
AuthorDate: Tue Feb 27 20:20:11 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar 7 18:49:07 2024 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b9294a02
depends.py: rename DependPrinter to Printer
The DependPrinter class name and documentation indicated that it was
meant to be part of the gentoolkit.dependencies API, to print
Dependencies objects. This Printer class is used exclusively for
printering equery depends output and is not a public API outside of
the depends.py module
Signed-off-by: John Turner <jturner.usa <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/depends.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index f92b7b9..39e0b25 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -35,8 +35,8 @@ QUERY_OPTS = {
# =======
-class DependPrinter:
- """Output L{gentoolkit.dependencies.Dependencies} objects."""
+class Printer:
+ """Output L{gentoolkit.dependencies.Dependencies} objects for equery depends."""
def __init__(self, verbose=True):
self.verbose = verbose
@@ -83,7 +83,7 @@ class DependPrinter:
)
def format_depend(self, dep, dep_is_displayed):
- """Format a dependency for printing.
+ """Format a dependency for printing for equery depends.
@type dep: L{gentoolkit.dependencies.Dependencies}
@param dep: the dependency to display
@@ -209,7 +209,7 @@ def main(input_args):
# Output
#
- dep_print = DependPrinter(verbose=CONFIG["verbose"])
+ printer = Printer(verbose=CONFIG["verbose"])
first_run = True
got_match = False
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
@ 2024-03-07 18:49 Sam James
0 siblings, 0 replies; 22+ messages in thread
From: Sam James @ 2024-03-07 18:49 UTC (permalink / raw
To: gentoo-commits
commit: b2dbcb184063104f750a407e0dbe3a4e0d3bfd9b
Author: John Turner <jturner.usa <AT> gmail <DOT> com>
AuthorDate: Fri Feb 23 01:38:29 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar 7 18:49:06 2024 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b2dbcb18
equery/depends: print output in module rather than with a callback
The depends module can now iterate over the results of the
graph_reverse_depends function and print the items as they are
yielded.
Before, it passed in a callback printer function, and expected the
Dependencies class to call it correctly.
This setup is nicer because it does not tie together this module and
the Dependencies class, and the old setup most likely existed due to
performance and interactivity concerns which are now fixed by turning
graph_reverse_depends into an iterator.
Signed-off-by: John Turner <jturner.usa <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
pym/gentoolkit/equery/depends.py | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 8ec5f75..f92b7b9 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -17,7 +17,6 @@ import gentoolkit.pprinter as pp
from gentoolkit.dependencies import Dependencies
from gentoolkit.equery import format_options, mod_usage, CONFIG
from gentoolkit.helpers import get_cpvs, get_installed_cpvs
-from gentoolkit.cpv import CPV
from gentoolkit.package import PackageFormatter, Package
# =======
@@ -27,7 +26,7 @@ from gentoolkit.package import PackageFormatter, Package
QUERY_OPTS = {
"include_masked": False,
"only_direct": True,
- "max_depth": -1,
+ "max_depth": None,
"package_format": None,
}
@@ -94,9 +93,9 @@ class DependPrinter:
if dep_is_displayed and not self.verbose:
return
- depth = getattr(dep, "depth", 0)
+ depth = dep.depth
indent = " " * depth
- mdep = dep.matching_dep
+ mdep = dep.depatom
use_conditional = ""
if QUERY_OPTS["package_format"] != None:
@@ -226,17 +225,25 @@ def main(input_args):
if CONFIG["verbose"]:
print(" * These packages depend on %s:" % pp.emph(pkg.cpv))
- if pkg.graph_reverse_depends(
- pkgset=sorted(pkggetter(), key=CPV),
- max_depth=QUERY_OPTS["max_depth"],
+
+ first_run = False
+
+ last_seen = None
+ for pkgdep in pkg.graph_reverse_depends(
+ pkgset=sorted(pkggetter()),
only_direct=QUERY_OPTS["only_direct"],
- printer_fn=dep_print,
+ max_depth=QUERY_OPTS["max_depth"],
):
+ if last_seen is None or last_seen != pkgdep:
+ seen = False
+ else:
+ seen = True
+ printer(pkgdep, dep_is_displayed=seen)
+ last_seen = pkgdep
+ if last_seen is not None:
got_match = True
- first_run = False
-
- if not got_match:
+ if got_match is None:
sys.exit(1)
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2024-03-07 18:49 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 12:32 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/ Mike Pagano
-- strict thread matches above, loose matches on Subject: below --
2024-03-07 18:49 Sam James
2024-03-07 18:49 Sam James
2023-09-19 19:13 Sam James
2023-08-05 5:38 Sam James
2023-07-18 22:30 Sam James
2023-07-18 22:26 Sam James
2022-07-28 15:29 Brian Dolbec
2022-07-28 15:29 Brian Dolbec
2022-07-10 18:41 Brian Dolbec
2022-07-10 18:01 Brian Dolbec
2022-07-10 16:23 Brian Dolbec
2022-07-10 16:23 Brian Dolbec
2022-07-10 1:24 Brian Dolbec
2022-07-09 5:17 Sam James
2017-09-05 15:32 Mike Gilbert
2016-06-30 23:36 Paul Varner
2016-06-30 20:44 Paul Varner
2016-06-06 19:29 Brian Dolbec
2015-11-09 20:52 Brian Dolbec
2015-11-09 2:42 Brian Dolbec
2015-11-08 17:37 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox