Run formatter over this

This commit is contained in:
decentral1se 2021-04-28 10:35:01 +02:00
parent be3fd59c8c
commit 78b9b8589e
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A

View File

@ -33,7 +33,7 @@ REPOS_TO_SKIP = (
"pyabra", "pyabra",
"stack-ssh-deploy", "stack-ssh-deploy",
"radicle-seed-node", "radicle-seed-node",
"coturn" "coturn",
) )
log = getLogger(__name__) log = getLogger(__name__)
@ -70,7 +70,7 @@ def get_repos_json():
try: try:
while response: while response:
log.info(f"Trying to fetch page {page}") log.info(f"Trying to fetch page {page}")
response = get(url + f"?page={page}",timeout=10).json() response = get(url + f"?page={page}", timeout=10).json()
repos.extend(response) repos.extend(response)
page += 1 page += 1
@ -80,7 +80,6 @@ def get_repos_json():
exit(1) exit(1)
def get_published_apps_json(): def get_published_apps_json():
"""Retrieve already published apps json.""" """Retrieve already published apps json."""
url = "https://apps.coopcloud.tech" url = "https://apps.coopcloud.tech"
@ -130,7 +129,7 @@ def generate_apps_json(repos_json):
log.info(f"Skipping {app}") log.info(f"Skipping {app}")
continue continue
repo_details = next(filter(lambda x: x['name'] == app, repos_json), {}) repo_details = next(filter(lambda x: x["name"] == app, repos_json), {})
app_path = f"{CLONES_PATH}/{app}" app_path = f"{CLONES_PATH}/{app}"
chdir(app_path) chdir(app_path)
@ -153,7 +152,7 @@ def generate_apps_json(repos_json):
# not. # not.
"features": metadata, "features": metadata,
"versions": get_app_versions(app_path, cached_apps_json), "versions": get_app_versions(app_path, cached_apps_json),
"icon": repo_details.get("avatar_url", "") "icon": repo_details.get("avatar_url", ""),
} }
return apps_json return apps_json
@ -217,8 +216,7 @@ def get_app_versions(app_path, cached_apps_json):
existing_tags = [] existing_tags = []
for tag in tags: for tag in tags:
_run_cmd(f"git checkout {tag}", _run_cmd(f"git checkout {tag}", stderr=DEVNULL)
stderr=DEVNULL)
services_cmd = f"{YQ_PATH} e '.services | keys | .[]' compose*.yml" services_cmd = f"{YQ_PATH} e '.services | keys | .[]' compose*.yml"
services = _run_cmd(services_cmd, shell=True).split() services = _run_cmd(services_cmd, shell=True).split()
@ -229,7 +227,10 @@ def get_app_versions(app_path, cached_apps_json):
if service in ("null", "---"): if service in ("null", "---"):
continue continue
if tag in existing_tags and service in cached_apps_json[app_name]["versions"][tag]: if (
tag in existing_tags
and service in cached_apps_json[app_name]["versions"][tag]
):
log.info(f"Skipping {tag} because we've already processed it") log.info(f"Skipping {tag} because we've already processed it")
existing_versions = cached_apps_json[app_name]["versions"][tag][service] existing_versions = cached_apps_json[app_name]["versions"][tag][service]
service_versions[service] = existing_versions service_versions[service] = existing_versions