aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2023-09-08 09:56:59 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-09-08 15:12:20 +0300
commit5a5bd751ad28317cc60754d1e874f82240daa2a1 (patch)
treee896a647a81e842a7e10425ea7c6d2c0617590f6
parentpyproject.tml: fix dependencies version (diff)
downloadpkgdev-5a5bd751ad28317cc60754d1e874f82240daa2a1.tar.gz
pkgdev-5a5bd751ad28317cc60754d1e874f82240daa2a1.tar.bz2
pkgdev-5a5bd751ad28317cc60754d1e874f82240daa2a1.zip
pkgdev_bugs: do not swallow exceptions when reading ~/.bugz_token
In case the file is not readable, or other issues, do not swallow the exception. Signed-off-by: Florian Schmaus <flow@gentoo.org> Closes: https://github.com/pkgcore/pkgdev/pull/158 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgdev/scripts/pkgdev_bugs.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py
index 26f77c5..c89d1c8 100644
--- a/src/pkgdev/scripts/pkgdev_bugs.py
+++ b/src/pkgdev/scripts/pkgdev_bugs.py
@@ -546,8 +546,9 @@ def main(options, out: Formatter, err: Formatter):
node.cleanup_keywords(search_repo)
if options.api_key is None:
- with contextlib.suppress(Exception):
- options.api_key = (Path.home() / ".bugz_token").read_text().strip() or None
+ bugz_token_file = Path.home() / ".bugz_token"
+ if bugz_token_file.is_file:
+ options.api_key = bugz_token_file.read_text().strip()
if not d.nodes:
out.write(out.fg("red"), "Nothing to do, exiting", out.reset)