diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-05-05 20:49:16 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-05-05 20:49:16 +0300 |
commit | 0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada (patch) | |
tree | 4df173c23fcfd1bd3573123a25212854460cb6fb | |
parent | bugs: add support for passing root blocker (diff) | |
download | pkgdev-0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada.tar.gz pkgdev-0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada.tar.bz2 pkgdev-0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada.zip |
bugs: fallback to `~/.bugz_token` for api-key
Resolves: https://github.com/pkgcore/pkgdev/issues/138
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | src/pkgdev/scripts/pkgdev_bugs.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 8c79ac6..e2eaf33 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -1,11 +1,13 @@ """Automatic bugs filer""" +import contextlib import json import sys import urllib.request as urllib from collections import defaultdict from functools import partial from itertools import chain +from pathlib import Path from urllib.parse import urlencode from pkgcheck import const as pkgcheck_const @@ -508,6 +510,10 @@ def main(options, out: Formatter, err: Formatter): for node in d.nodes: 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 + if userquery("Check for open bugs matching current graph?", out, err, default_answer=False): d.scan_existing_bugs(options.api_key) |