mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-28 17:27:17 +00:00
Compare commits
2 Commits
342b3cb652
...
4bb598d2eb
Author | SHA1 | Date | |
---|---|---|---|
4bb598d2eb | |||
f47be6cab0 |
@ -5,7 +5,7 @@ formats: all
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3.9"
|
||||
python: "3.10"
|
||||
|
||||
sphinx:
|
||||
builder: html
|
||||
|
@ -133,7 +133,9 @@ class Setup(Handler):
|
||||
repository(str): repository name
|
||||
paths(RepositoryPaths): repository paths instance
|
||||
"""
|
||||
configuration = Configuration()
|
||||
# allow_no_value=True is required because pacman uses boolean configuration in which just keys present
|
||||
# (e.g. NoProgressBar) which will lead to exception
|
||||
configuration = Configuration(allow_no_value=True)
|
||||
# preserve case
|
||||
# stupid mypy thinks that it is impossible
|
||||
configuration.optionxform = lambda key: key # type: ignore
|
||||
|
@ -70,11 +70,15 @@ class Configuration(configparser.RawConfigParser):
|
||||
ARCHITECTURE_SPECIFIC_SECTIONS = ["build", "sign", "web"]
|
||||
SYSTEM_CONFIGURATION_PATH = Path(sys.prefix) / "share" / "ahriman" / "settings" / "ahriman.ini"
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, allow_no_value: bool = False) -> None:
|
||||
"""
|
||||
default constructor. In the most cases must not be called directly
|
||||
|
||||
Args:
|
||||
allow_no_value(bool): copies ``configparser.RawConfigParser`` behaviour. In case if it is set to ``True``,
|
||||
the keys without values will be allowed
|
||||
"""
|
||||
configparser.RawConfigParser.__init__(self, allow_no_value=True, converters={
|
||||
configparser.RawConfigParser.__init__(self, allow_no_value=allow_no_value, converters={
|
||||
"list": self.__convert_list,
|
||||
"path": self.__convert_path,
|
||||
})
|
||||
|
@ -43,7 +43,7 @@ class ReportTrigger(Trigger):
|
||||
configuration(Configuration): configuration instance
|
||||
"""
|
||||
Trigger.__init__(self, architecture, configuration)
|
||||
self.targets = configuration.getlist("report", "target")
|
||||
self.targets = configuration.getlist("report", "target", fallback=[])
|
||||
|
||||
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
|
||||
"""
|
||||
|
@ -97,7 +97,7 @@ class GPG(LazyLogging):
|
||||
Tuple[Set[SignSettings], Optional[str]]: tuple of sign targets and default PGP key
|
||||
"""
|
||||
targets: Set[SignSettings] = set()
|
||||
for option in configuration.getlist("sign", "target"):
|
||||
for option in configuration.getlist("sign", "target", fallback=[]):
|
||||
target = SignSettings.from_option(option)
|
||||
if target == SignSettings.Disabled:
|
||||
continue
|
||||
|
@ -33,7 +33,7 @@ class HttpUpload(Upload):
|
||||
helper for the http based uploads
|
||||
|
||||
Attributes:
|
||||
auth(Tuple[str, str]): HTTP auth object
|
||||
auth(Optional[Tuple[str, str]]): HTTP auth object if set
|
||||
timeout(int): HTTP request timeout in seconds
|
||||
"""
|
||||
|
||||
@ -47,9 +47,9 @@ class HttpUpload(Upload):
|
||||
section(str): configuration section name
|
||||
"""
|
||||
Upload.__init__(self, architecture, configuration)
|
||||
password = configuration.get(section, "password")
|
||||
username = configuration.get(section, "username")
|
||||
self.auth = (password, username)
|
||||
password = configuration.get(section, "password", fallback=None)
|
||||
username = configuration.get(section, "username", fallback=None)
|
||||
self.auth = (password, username) if password and username else None
|
||||
self.timeout = configuration.getint(section, "timeout", fallback=30)
|
||||
|
||||
@staticmethod
|
||||
|
@ -43,7 +43,7 @@ class UploadTrigger(Trigger):
|
||||
configuration(Configuration): configuration instance
|
||||
"""
|
||||
Trigger.__init__(self, architecture, configuration)
|
||||
self.targets = configuration.getlist("upload", "target")
|
||||
self.targets = configuration.getlist("upload", "target", fallback=[])
|
||||
|
||||
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user