From ae6b32c786311af2585e62cf8fa39f8cddcfd62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 15 Feb 2024 11:04:57 +0100 Subject: [PATCH] Handle invalid syntax in some local app's manifest during initial apps listing --- .../autoupdate_app_sources.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/autoupdate_app_sources/autoupdate_app_sources.py b/autoupdate_app_sources/autoupdate_app_sources.py index 4225d22..5e7aba4 100755 --- a/autoupdate_app_sources/autoupdate_app_sources.py +++ b/autoupdate_app_sources/autoupdate_app_sources.py @@ -57,7 +57,7 @@ def get_github() -> tuple[tuple[str, str] | None, github.Github | None, github.I return None, None, None -def apps_to_run_auto_update_for(): +def apps_to_run_auto_update_for() -> list[str]: apps_flagged_as_working_and_on_yunohost_apps_org = [ app for app, infos in get_catalog().items() @@ -67,12 +67,15 @@ def apps_to_run_auto_update_for(): relevant_apps = [] for app in apps_flagged_as_working_and_on_yunohost_apps_org: - manifest_toml = app_cache_folder(app) / "manifest.toml" - if manifest_toml.exists(): - manifest = toml.load(manifest_toml.open("r", encoding="utf-8")) - sources = manifest.get("resources", {}).get("sources", {}) - if any("autoupdate" in source for source in sources.values()): - relevant_apps.append(app) + try: + manifest_toml = app_cache_folder(app) / "manifest.toml" + if manifest_toml.exists(): + manifest = toml.load(manifest_toml.open("r", encoding="utf-8")) + sources = manifest.get("resources", {}).get("sources", {}) + if any("autoupdate" in source for source in sources.values()): + relevant_apps.append(app) + except Exception as e: + print(f"Error while loading {app}'s manifest: {e}") return relevant_apps