Skip to content

Commit 6216528

Browse files
authored
fix newest branch logic
1 parent e6db28e commit 6216528

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

platform.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,22 @@ def install_tool(TOOL, retry_count=0):
120120
if "arduino" in frameworks:
121121
self.packages["framework-arduinoespressif32"]["optional"] = False
122122
self.packages["framework-arduinoespressif32-libs"]["optional"] = False
123-
try:
124-
# use newer branch idf-master when existing
123+
124+
# use newer branch idf-master when existing
125+
URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/idf-master/package/package_esp32_index.template.json"
126+
req = requests.get(URL)
127+
if req.status_code == 200:
128+
packjdata = req.json()
125129
self.packages["framework-arduinoespressif32"]["version"] = "https://github.com/espressif/arduino-esp32/archive/refs/heads/idf-master.zip"
126-
URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/idf-master/package/package_esp32_index.template.json"
127-
except:
130+
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
131+
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
132+
else:
128133
# use branch release/v3.3.x
129134
URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/release/v3.3.x/package/package_esp32_index.template.json"
130-
packjdata = requests.get(URL).json()
131-
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
132-
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
135+
req = requests.get(URL)
136+
packjdata = requests.get(URL).json()
137+
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
138+
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
133139

134140
if variables.get("custom_sdkconfig") is not None or len(str(board_sdkconfig)) > 3:
135141
frameworks.append("espidf")

0 commit comments

Comments
 (0)