Make offline use possible again

* make more failsafe when no Internet connection
This commit is contained in:
Jason2866
2024-11-24 17:14:48 +01:00
committed by GitHub
parent 9a07688651
commit 9ad58a5a27
+16 -12
View File
@@ -45,18 +45,22 @@ class Espressif32Platform(PlatformBase):
if "arduino" in frameworks: if "arduino" in frameworks:
self.packages["framework-arduinoespressif32"]["optional"] = False self.packages["framework-arduinoespressif32"]["optional"] = False
self.packages["framework-arduinoespressif32-libs"]["optional"] = False self.packages["framework-arduinoespressif32-libs"]["optional"] = False
# use latest stable release Arduino core try:
ARDUINO_CORE_API_URL = "https://api.github.com/repos/espressif/Arduino-esp32/releases/latest" # use latest stable release Arduino core
api_data = requests.get(ARDUINO_CORE_API_URL, timeout=10).json() ARDUINO_CORE_API_URL = "https://api.github.com/repos/espressif/Arduino-esp32/releases/latest"
zipball = api_data.get("zipball_url") api_data = requests.get(ARDUINO_CORE_API_URL, timeout=2).json()
tag = api_data.get("tag_name") zipball = api_data.get("zipball_url")
# print("Latest release Arduino core URL:", zipball) tag = api_data.get("tag_name")
self.packages["framework-arduinoespressif32"]["version"] = zipball if tag is not None:
# use corresponding espressif Arduino libs to release # print("Latest release Arduino core URL:", zipball)
URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/" + tag + "/package/package_esp32_index.template.json" self.packages["framework-arduinoespressif32"]["version"] = zipball
packjdata = requests.get(URL, timeout=10).json() # use corresponding espressif Arduino libs to release
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url'] URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/" + tag + "/package/package_esp32_index.template.json"
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url packjdata = requests.get(URL, timeout=10).json()
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
except:
pass
if "buildfs" in targets: if "buildfs" in targets:
filesystem = variables.get("board_build.filesystem", "littlefs") filesystem = variables.get("board_build.filesystem", "littlefs")