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 ...
|
# Some apps have a higher runtime value than build ...
|
||||||
if ram_requirement["build"] != "?" and ram_requirement["runtime"] != "?":
|
if ram_requirement["build"] != "?" and ram_requirement["runtime"] != "?":
|
||||||
max_build_runtime = (ram_requirement["build"]
|
max_build_runtime = (
|
||||||
if human_to_binary(ram_requirement["build"]) > human_to_binary(ram_requirement["runtime"])
|
ram_requirement["build"]
|
||||||
else ram_requirement["runtime"])
|
if human_to_binary(ram_requirement["build"])
|
||||||
|
> human_to_binary(ram_requirement["runtime"])
|
||||||
|
else ram_requirement["runtime"]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
max_build_runtime = ram_requirement["build"]
|
max_build_runtime = ram_requirement["build"]
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,9 @@ def test_app_from_catalog():
|
||||||
assert app_map_[main_domain]["/site"]["id"] == "my_webapp"
|
assert app_map_[main_domain]["/site"]["id"] == "my_webapp"
|
||||||
|
|
||||||
assert app_is_installed(main_domain, "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
|
# Try upgrade, should do nothing
|
||||||
app_upgrade("my_webapp")
|
app_upgrade("my_webapp")
|
||||||
|
|
|
@ -71,9 +71,13 @@ def test_repo_url_definition():
|
||||||
|
|
||||||
### Gitea
|
### 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")
|
||||||
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/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
|
### Invalid patterns
|
||||||
|
|
||||||
|
|
|
@ -1065,9 +1065,11 @@ class AptDependenciesAppResource(AppResource):
|
||||||
if isinstance(values.get("packages"), str):
|
if isinstance(values.get("packages"), str):
|
||||||
values["packages"] = [value.strip() for value in values["packages"].split(",")] # type: ignore
|
values["packages"] = [value.strip() for value in values["packages"].split(",")] # type: ignore
|
||||||
|
|
||||||
if not isinstance(values.get("repo"), str) \
|
if (
|
||||||
or not isinstance(values.get("key"), str) \
|
not isinstance(values.get("repo"), str)
|
||||||
or not isinstance(values.get("packages"), list):
|
or not isinstance(values.get("key"), str)
|
||||||
|
or not isinstance(values.get("packages"), list)
|
||||||
|
):
|
||||||
raise YunohostError(
|
raise YunohostError(
|
||||||
"In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' defined as strings and 'packages' defined as list",
|
"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,
|
raw_msg=True,
|
||||||
|
@ -1076,12 +1078,14 @@ class AptDependenciesAppResource(AppResource):
|
||||||
def provision_or_update(self, context: Dict = {}):
|
def provision_or_update(self, context: Dict = {}):
|
||||||
script = " ".join(["ynh_install_app_dependencies", *self.packages])
|
script = " ".join(["ynh_install_app_dependencies", *self.packages])
|
||||||
for repo, values in self.extras.items():
|
for repo, values in self.extras.items():
|
||||||
script += "\n" + " ".join([
|
script += "\n" + " ".join(
|
||||||
|
[
|
||||||
"ynh_install_extra_app_dependencies",
|
"ynh_install_extra_app_dependencies",
|
||||||
f"--repo='{values['repo']}'",
|
f"--repo='{values['repo']}'",
|
||||||
f"--key='{values['key']}'",
|
f"--key='{values['key']}'",
|
||||||
f"--package='{' '.join(values['packages'])}'"
|
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..
|
# 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)
|
self._run_script("provision_or_update", script)
|
||||||
|
|
Loading…
Add table
Reference in a new issue