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:
|
build:
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
tools:
|
tools:
|
||||||
python: "3.9"
|
python: "3.10"
|
||||||
|
|
||||||
sphinx:
|
sphinx:
|
||||||
builder: html
|
builder: html
|
||||||
|
@ -133,7 +133,9 @@ class Setup(Handler):
|
|||||||
repository(str): repository name
|
repository(str): repository name
|
||||||
paths(RepositoryPaths): repository paths instance
|
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
|
# 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
|
||||||
|
@ -70,11 +70,15 @@ 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) -> None:
|
def __init__(self, allow_no_value: bool = False) -> 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=True, converters={
|
configparser.RawConfigParser.__init__(self, allow_no_value=allow_no_value, converters={
|
||||||
"list": self.__convert_list,
|
"list": self.__convert_list,
|
||||||
"path": self.__convert_path,
|
"path": self.__convert_path,
|
||||||
})
|
})
|
||||||
|
@ -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")
|
self.targets = configuration.getlist("report", "target", fallback=[])
|
||||||
|
|
||||||
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
|
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
|
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"):
|
for option in configuration.getlist("sign", "target", fallback=[]):
|
||||||
target = SignSettings.from_option(option)
|
target = SignSettings.from_option(option)
|
||||||
if target == SignSettings.Disabled:
|
if target == SignSettings.Disabled:
|
||||||
continue
|
continue
|
||||||
|
@ -33,7 +33,7 @@ class HttpUpload(Upload):
|
|||||||
helper for the http based uploads
|
helper for the http based uploads
|
||||||
|
|
||||||
Attributes:
|
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
|
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")
|
password = configuration.get(section, "password", fallback=None)
|
||||||
username = configuration.get(section, "username")
|
username = configuration.get(section, "username", fallback=None)
|
||||||
self.auth = (password, username)
|
self.auth = (password, username) if password and username else None
|
||||||
self.timeout = configuration.getint(section, "timeout", fallback=30)
|
self.timeout = configuration.getint(section, "timeout", fallback=30)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -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")
|
self.targets = configuration.getlist("upload", "target", fallback=[])
|
||||||
|
|
||||||
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
|
def on_result(self, result: Result, packages: Iterable[Package]) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user