mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[CI] Format code with Black
This commit is contained in:
parent
5b726bb8c0
commit
14040b8fd2
5 changed files with 30 additions and 17 deletions
|
@ -2784,9 +2784,12 @@ def _check_manifest_requirements(
|
|||
|
||||
# Some apps have a higher runtime value than build ...
|
||||
if ram_requirement["build"] != "?" and ram_requirement["runtime"] != "?":
|
||||
max_build_runtime = (ram_requirement["build"]
|
||||
if human_to_binary(ram_requirement["build"]) > human_to_binary(ram_requirement["runtime"])
|
||||
else ram_requirement["runtime"])
|
||||
max_build_runtime = (
|
||||
ram_requirement["build"]
|
||||
if human_to_binary(ram_requirement["build"])
|
||||
> human_to_binary(ram_requirement["runtime"])
|
||||
else ram_requirement["runtime"]
|
||||
)
|
||||
else:
|
||||
max_build_runtime = ram_requirement["build"]
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class MyDiagnoser(Diagnoser):
|
|||
if success != "ok":
|
||||
return None
|
||||
else:
|
||||
if type_ == "TXT" and isinstance(answers,list):
|
||||
if type_ == "TXT" and isinstance(answers, list):
|
||||
for part in answers:
|
||||
if part.startswith('"v=spf1'):
|
||||
return part
|
||||
|
|
|
@ -339,7 +339,9 @@ def test_app_from_catalog():
|
|||
assert app_map_[main_domain]["/site"]["id"] == "my_webapp"
|
||||
|
||||
assert app_is_installed(main_domain, "my_webapp")
|
||||
assert app_is_exposed_on_http(main_domain, "/site", "you have just installed My Webapp")
|
||||
assert app_is_exposed_on_http(
|
||||
main_domain, "/site", "you have just installed My Webapp"
|
||||
)
|
||||
|
||||
# Try upgrade, should do nothing
|
||||
app_upgrade("my_webapp")
|
||||
|
|
|
@ -71,10 +71,14 @@ def test_repo_url_definition():
|
|||
|
||||
### Gitea
|
||||
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh")
|
||||
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/branch/branch_name")
|
||||
assert _is_app_repo_url(
|
||||
"https://gitea.instance.tld/user/repo_ynh/src/branch/branch_name"
|
||||
)
|
||||
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/tag/tag_name")
|
||||
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/commit/abcd1234")
|
||||
|
||||
assert _is_app_repo_url(
|
||||
"https://gitea.instance.tld/user/repo_ynh/src/commit/abcd1234"
|
||||
)
|
||||
|
||||
### Invalid patterns
|
||||
|
||||
# no schema
|
||||
|
|
|
@ -1065,9 +1065,11 @@ class AptDependenciesAppResource(AppResource):
|
|||
if isinstance(values.get("packages"), str):
|
||||
values["packages"] = [value.strip() for value in values["packages"].split(",")] # type: ignore
|
||||
|
||||
if not isinstance(values.get("repo"), str) \
|
||||
or not isinstance(values.get("key"), str) \
|
||||
or not isinstance(values.get("packages"), list):
|
||||
if (
|
||||
not isinstance(values.get("repo"), str)
|
||||
or not isinstance(values.get("key"), str)
|
||||
or not isinstance(values.get("packages"), list)
|
||||
):
|
||||
raise YunohostError(
|
||||
"In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' defined as strings and 'packages' defined as list",
|
||||
raw_msg=True,
|
||||
|
@ -1076,12 +1078,14 @@ class AptDependenciesAppResource(AppResource):
|
|||
def provision_or_update(self, context: Dict = {}):
|
||||
script = " ".join(["ynh_install_app_dependencies", *self.packages])
|
||||
for repo, values in self.extras.items():
|
||||
script += "\n" + " ".join([
|
||||
"ynh_install_extra_app_dependencies",
|
||||
f"--repo='{values['repo']}'",
|
||||
f"--key='{values['key']}'",
|
||||
f"--package='{' '.join(values['packages'])}'"
|
||||
])
|
||||
script += "\n" + " ".join(
|
||||
[
|
||||
"ynh_install_extra_app_dependencies",
|
||||
f"--repo='{values['repo']}'",
|
||||
f"--key='{values['key']}'",
|
||||
f"--package='{' '.join(values['packages'])}'",
|
||||
]
|
||||
)
|
||||
# FIXME : we're feeding the raw value of values['packages'] to the helper .. if we want to be consistent, may they should be comma-separated, though in the majority of cases, only a single package is installed from an extra repo..
|
||||
|
||||
self._run_script("provision_or_update", script)
|
||||
|
|
Loading…
Add table
Reference in a new issue