From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 799C315ACFC for ; Fri, 5 May 2023 17:49:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B12DCE09D6; Fri, 5 May 2023 17:49:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 98293E09D6 for ; Fri, 5 May 2023 17:49:57 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C178434152A for ; Fri, 5 May 2023 17:49:56 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 368218E4 for ; Fri, 5 May 2023 17:49:55 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1683308956.0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgdev:main commit in: src/pkgdev/scripts/ X-VCS-Repository: proj/pkgcore/pkgdev X-VCS-Files: src/pkgdev/scripts/pkgdev_bugs.py X-VCS-Directories: src/pkgdev/scripts/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada X-VCS-Branch: main Date: Fri, 5 May 2023 17:49:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8844c4ad-4ca6-41b0-990a-70e89e741197 X-Archives-Hash: 92ecbb7fc3db0380b4786adf0c70f9f3 commit: 0a1c70e0f501f6cdda4cef3cd9940c2f5dac8ada Author: Arthur Zamarin gentoo org> AuthorDate: Fri May 5 17:49:16 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Fri May 5 17:49:16 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=0a1c70e0 bugs: fallback to `~/.bugz_token` for api-key Resolves: https://github.com/pkgcore/pkgdev/issues/138 Signed-off-by: Arthur Zamarin gentoo.org> src/pkgdev/scripts/pkgdev_bugs.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)