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: build:
os: ubuntu-20.04 os: ubuntu-20.04
tools: tools:
python: "3.10" python: "3.9"
sphinx: sphinx:
builder: html builder: html

View File

@ -133,9 +133,7 @@ class Setup(Handler):
repository(str): repository name repository(str): repository name
paths(RepositoryPaths): repository paths instance paths(RepositoryPaths): repository paths instance
""" """
# allow_no_value=True is required because pacman uses boolean configuration in which just keys present configuration = Configuration()
# (e.g. NoProgressBar) which will lead to exception
configuration = Configuration(allow_no_value=True)
# preserve case # preserve case
# stupid mypy thinks that it is impossible # stupid mypy thinks that it is impossible
configuration.optionxform = lambda key: key # type: ignore configuration.optionxform = lambda key: key # type: ignore

View File

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

View File

@ -43,7 +43,7 @@ class ReportTrigger(Trigger):
configuration(Configuration): configuration instance configuration(Configuration): configuration instance
""" """
Trigger.__init__(self, architecture, configuration) 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: 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 Tuple[Set[SignSettings], Optional[str]]: tuple of sign targets and default PGP key
""" """
targets: Set[SignSettings] = set() targets: Set[SignSettings] = set()
for option in configuration.getlist("sign", "target", fallback=[]): for option in configuration.getlist("sign", "target"):
target = SignSettings.from_option(option) target = SignSettings.from_option(option)
if target == SignSettings.Disabled: if target == SignSettings.Disabled:
continue continue

View File

@ -33,7 +33,7 @@ class HttpUpload(Upload):
helper for the http based uploads helper for the http based uploads
Attributes: 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 timeout(int): HTTP request timeout in seconds
""" """
@ -47,9 +47,9 @@ class HttpUpload(Upload):
section(str): configuration section name section(str): configuration section name
""" """
Upload.__init__(self, architecture, configuration) Upload.__init__(self, architecture, configuration)
password = configuration.get(section, "password", fallback=None) password = configuration.get(section, "password")
username = configuration.get(section, "username", fallback=None) username = configuration.get(section, "username")
self.auth = (password, username) if password and username else None self.auth = (password, username)
self.timeout = configuration.getint(section, "timeout", fallback=30) self.timeout = configuration.getint(section, "timeout", fallback=30)
@staticmethod @staticmethod

View File

@ -43,7 +43,7 @@ class UploadTrigger(Trigger):
configuration(Configuration): configuration instance configuration(Configuration): configuration instance
""" """
Trigger.__init__(self, architecture, configuration) 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: def on_result(self, result: Result, packages: Iterable[Package]) -> None:
""" """