Compare commits

..

No commits in common. "4bb598d2ebfe00cff5c87b08e5b78775a9d3b1bf" and "342b3cb652d66c4515966f8a0067b393cf406051" have entirely different histories.

7 changed files with 11 additions and 17 deletions

View File

@ -5,7 +5,7 @@ formats: all
build:
os: ubuntu-20.04
tools:
python: "3.10"
python: "3.9"
sphinx:
builder: html

View File

@ -133,9 +133,7 @@ class Setup(Handler):
repository(str): repository name
paths(RepositoryPaths): repository paths instance
"""
# 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)
configuration = Configuration()
# preserve case
# stupid mypy thinks that it is impossible
configuration.optionxform = lambda key: key # type: ignore

View File

@ -70,15 +70,11 @@ class Configuration(configparser.RawConfigParser):
ARCHITECTURE_SPECIFIC_SECTIONS = ["build", "sign", "web"]
SYSTEM_CONFIGURATION_PATH = Path(sys.prefix) / "share" / "ahriman" / "settings" / "ahriman.ini"
def __init__(self, allow_no_value: bool = False) -> None:
def __init__(self) -> 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=allow_no_value, converters={
configparser.RawConfigParser.__init__(self, allow_no_value=True, converters={
"list": self.__convert_list,
"path": self.__convert_path,
})

View File

@ -43,7 +43,7 @@ class ReportTrigger(Trigger):
configuration(Configuration): configuration instance
"""
Trigger.__init__(self, architecture, configuration)
self.targets = configuration.getlist("report", "target", fallback=[])
self.targets = configuration.getlist("report", "target")
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
"""

View File

@ -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", fallback=[]):
for option in configuration.getlist("sign", "target"):
target = SignSettings.from_option(option)
if target == SignSettings.Disabled:
continue

View File

@ -33,7 +33,7 @@ class HttpUpload(Upload):
helper for the http based uploads
Attributes:
auth(Optional[Tuple[str, str]]): HTTP auth object if set
auth(Tuple[str, str]): HTTP auth object
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", fallback=None)
username = configuration.get(section, "username", fallback=None)
self.auth = (password, username) if password and username else None
password = configuration.get(section, "password")
username = configuration.get(section, "username")
self.auth = (password, username)
self.timeout = configuration.getint(section, "timeout", fallback=30)
@staticmethod

View File

@ -43,7 +43,7 @@ class UploadTrigger(Trigger):
configuration(Configuration): configuration instance
"""
Trigger.__init__(self, architecture, configuration)
self.targets = configuration.getlist("upload", "target", fallback=[])
self.targets = configuration.getlist("upload", "target")
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
"""