From 3a4d499cf40443bc08f7aac703e793a97c236963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sat, 9 Mar 2024 15:47:01 +0100 Subject: [PATCH] better handling of exceptions, again --- tools/autoupdate_app_sources/rest_api.py | 1 + tools/find_deprecated.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/autoupdate_app_sources/rest_api.py b/tools/autoupdate_app_sources/rest_api.py index 35bda4288f..3a5451410f 100644 --- a/tools/autoupdate_app_sources/rest_api.py +++ b/tools/autoupdate_app_sources/rest_api.py @@ -57,6 +57,7 @@ def url_for_ref(self, ref: str, ref_type: RefType) -> str: class GitlabAPI: def __init__(self, upstream: str): # Find gitlab api root... + upstream = upstream.rstrip("/") self.forge_root = self.get_forge_root(upstream).rstrip("/") self.project_path = upstream.replace(self.forge_root, "").lstrip("/") self.project_id = self.find_project_id(self.project_path) diff --git a/tools/find_deprecated.py b/tools/find_deprecated.py index 17f9cb1166..cb302f646e 100755 --- a/tools/find_deprecated.py +++ b/tools/find_deprecated.py @@ -60,12 +60,16 @@ def upstream_last_update_ago(app: str) -> tuple[str, int | None]: api = None try: if upstream.startswith("https://github.com/"): - api = GithubAPI(upstream, auth=get_github()[0]) + try: + api = GithubAPI(upstream, auth=get_github()[0]) + except AssertionError as e: + logging.error(f"Exception while handling {app}: {e}") + return app, None - if upstream.startswith("https://gitlab."): + if upstream.startswith("https://gitlab.") or upstream.startswith("https://framagit.org"): api = GitlabAPI(upstream) - if upstream.startswith("https://codeberg.org") or upstream.startswith("https://framagit.org"): + if upstream.startswith("https://codeberg.org"): api = GiteaForgejoAPI(upstream) if not api: