Skip to content

Commit 4d4df74

Browse files
committed
build_parameters.py: fix htmlparser
fix class fix error handling fix parsing element simplify elements parsed and return
1 parent 823832c commit 4d4df74

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

build_parameters.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ def handle_starttag(self, tag, attrs):
269269
if tag == 'a':
270270
attr = dict(attrs)
271271
href = attr.get('href')
272-
self.links.append(href)
272+
if href and vehicle.lower() in href.lower():
273+
# Only select folders with the vehicle name in it
274+
self.links.append(href)
273275

274276
html_parser = ParseText()
275277
try:
@@ -319,7 +321,8 @@ def handle_starttag(self, tag, attrs):
319321
if tag == 'a':
320322
attr = dict(attrs)
321323
href = attr.get('href')
322-
self.links.append(href)
324+
if href:
325+
self.links.append(href)
323326

324327
html_parser = ParseText()
325328
try:
@@ -328,6 +331,9 @@ def handle_starttag(self, tag, attrs):
328331
except Exception as e:
329332
error(f"Board folders list download error: {e}")
330333
finally:
334+
if len(html_parser.links) == 0:
335+
error(f"No board folders found in {url}, skipping this release.")
336+
return ""
331337
last_folder = html_parser.links.pop()
332338
board_name = os.path.basename(last_folder)
333339
debug(f"Returning link of the last board folder ({board_name})")
@@ -342,6 +348,9 @@ def fetch_commit_hash(version_link, board, file):
342348
fetch_link = f"{version_link}/{board}/{file}"
343349

344350
progress(f"Processing link...\t{fetch_link}")
351+
if board == "":
352+
error(f"Board folder not found in {version_link}, skipping this release.")
353+
return "error", "error", "error"
345354

346355
try:
347356
fecth_response = ""

0 commit comments

Comments
 (0)