File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
22import subprocess
33from configparser import ConfigParser
4+ from contextlib import suppress
45from pathlib import Path
56
67from pkgcore .repository import errors as repo_errors
@@ -75,8 +76,13 @@ def _default_api_key(namespace, attr):
7576 try :
7677 config = ConfigParser (default_section = "default" )
7778 config .read (bugz_rc_file )
78- setattr (namespace , attr , config .get ("default" , "key" ))
7979 except Exception as e :
8080 raise ValueError (f"failed parsing { bugz_rc_file } : { e } " )
81- elif (bugz_token_file := Path .home () / ".bugz_token" ).is_file ():
81+
82+ for category in ("default" , "gentoo" , "Gentoo" ):
83+ with suppress (Exception ):
84+ setattr (namespace , attr , config .get (category , "key" ))
85+ return
86+
87+ if (bugz_token_file := Path .home () / ".bugz_token" ).is_file ():
8288 setattr (namespace , attr , bugz_token_file .read_text ().strip ())
You can’t perform that action at this time.
0 commit comments