aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-11-12 12:49:25 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2022-11-12 12:49:25 +0200
commitfa5153ff81b8159fa59dc2495f5bf9cdf36a99a4 (patch)
tree1da57da2692588c390c062ff660178bfef0ad4a2
parentebuild/test_eapi.py: fix test_register artifacts (diff)
downloadpkgcore-fa5153ff81b8159fa59dc2495f5bf9cdf36a99a4.tar.gz
pkgcore-fa5153ff81b8159fa59dc2495f5bf9cdf36a99a4.tar.bz2
pkgcore-fa5153ff81b8159fa59dc2495f5bf9cdf36a99a4.zip
pquery: fix crash with verbose single uris attr
When the `uris` attribute has only one value, and the `verbose` option was used, pquery was crashing because `node.uri` isn't subscriptable. Use more agnostic `next(iter(node.uris))` instead. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgcore/scripts/pquery.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkgcore/scripts/pquery.py b/src/pkgcore/scripts/pquery.py
index 6bc04994d..eaba242f3 100644
--- a/src/pkgcore/scripts/pquery.py
+++ b/src/pkgcore/scripts/pquery.py
@@ -269,7 +269,7 @@ def format_attr(config, out, pkg, attr):
if not node.uri:
return False
if len(node.uri) == 1:
- out.write(node.uri[0], autoline=False)
+ out.write(next(iter(node.uri)), autoline=False)
return False
out.write('|| (')
out.first_prefix.append(' ')