From 217aa3bd9d573043d3c8b6a5969618364f7f5ff4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 3 Jan 2024 20:41:44 +0100 Subject: [PATCH] gnu compare: try to use a local copy if the download failed --- util/remaining-gnu-error.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/util/remaining-gnu-error.py b/util/remaining-gnu-error.py index 7bd9b141a..20b3faee7 100755 --- a/util/remaining-gnu-error.py +++ b/util/remaining-gnu-error.py @@ -11,10 +11,21 @@ import json import sys base = "../gnu/tests/" -urllib.request.urlretrieve( - "https://raw.githubusercontent.com/uutils/coreutils-tracking/main/gnu-full-result.json", - "result.json", -) + +# Try to download the file, use local copy if download fails +result_json = "result.json" +try: + urllib.request.urlretrieve( + "https://raw.githubusercontent.com/uutils/coreutils-tracking/main/gnu-full-result.json", + result_json + ) +except Exception as e: + print(f"Failed to download the file: {e}") + if not os.path.exists(result_json): + print(f"Local file '{result_json}' not found. Exiting.") + sys.exit(1) + else: + print(f"Using local file '{result_json}'.") types = ("/*/*.sh", "/*/*.pl", "/*/*.xpl")