From 069a058a83ebb9fbf35bbe3c76691564a830f3ad Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 14 Mar 2023 22:37:56 -0400 Subject: [PATCH] update build_board_info.py per Neradoc --- tools/build_board_info.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 5209337b95..01d935ac46 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -6,6 +6,7 @@ import json import os +import requests import subprocess import sys import sh @@ -96,7 +97,19 @@ def get_current_info(): response = response.json() git_info = commit_sha, response["sha"] - current_list = json.loads(base64.b64decode(response["content"]).decode("utf-8")) + + if response["content"] != "": + # if the file is there + current_list = json.loads(base64.b64decode(response["content"]).decode("utf-8")) + else: + # if too big, the file is not included + download_url = response["download_url"] + response = requests.get(download_url) + if not response.ok: + print(response.text) + raise RuntimeError("cannot get previous files.json") + current_list = response.json() + current_info = {} for info in current_list: current_info[info["id"]] = info