This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git
The following commit(s) were added to refs/heads/master by this push:
new e324d4bd30 Improve build script
e324d4bd30 is described below
commit e324d4bd30356d58a980d19f1b4ecb7efc4ec6f1
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Jul 21 09:45:13 2026 +0200
Improve build script
Make find_BSPs() bit more verbose and resilient.
---
build.py | 57 +++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 14 deletions(-)
diff --git a/build.py b/build.py
index 159927ca05..7b019978a7 100755
--- a/build.py
+++ b/build.py
@@ -61,22 +61,51 @@ def generate_supported_boards(filename, bsps):
def find_BSPs():
bsp_dir = path.join(cwd, '../mynewt-core', BSP_DIR)
if not path.isdir(bsp_dir):
- raise Exception("The directory %s does not exist".format(bsp_dir))
+ raise Exception("The directory {} does not exist".format(bsp_dir))
+
bsps = []
for bsp in listdir(bsp_dir):
- with open(path.join(bsp_dir, bsp, "bsp.yml"), 'r') as f:
- data = yaml.full_load(f)
- if data.get('bsp.exclude_site') == 1:
- print("{} has 'exclude_site' set, skipping".format(bsp))
- continue
- for k in ['bsp.name', 'bsp.url', 'bsp.maker', 'bsp.arch']:
- if k not in data:
- print("{} is missing metadata".format(bsp))
- break
- else:
- bsp = BSP(name=data['bsp.name'], url=data['bsp.url'],
- maker=data['bsp.maker'], arch=data['bsp.arch'])
- bsps.append(bsp)
+ bsp_path = path.join(bsp_dir, bsp)
+ yaml_path = path.join(bsp_path, "bsp.yml")
+
+ print("{} generating...".format(bsp))
+
+ # skip non-dirs (eg. pkg.yml)
+ if not path.isdir(bsp_path):
+ print("{} is not a directory, skipping".format(bsp))
+ continue
+
+ # no bsp.yml file, skip
+ if not path.isfile(yaml_path):
+ print("{} has no bsp.yml, skipping".format(bsp))
+ continue
+
+ try:
+ with open(yaml_path, 'r') as f:
+ data = yaml.full_load(f)
+
+ # skip if yaml is invalid
+ if not isinstance(data, dict):
+ print("{} bsp.yml is not valid, skipping".format(bsp))
+ continue
+
+ if data.get('bsp.exclude_site') == 1:
+ print("{} has 'exclude_site' set, skipping".format(bsp))
+ continue
+
+ for k in ['bsp.name', 'bsp.url', 'bsp.maker', 'bsp.arch']:
+ if k not in data:
+ print("{} is missing metadata".format(bsp))
+ break
+ else:
+ bsp_obj = BSP(name=data['bsp.name'], url=data['bsp.url'],
+ maker=data['bsp.maker'],
arch=data['bsp.arch'])
+ bsps.append(bsp_obj)
+
+ except Exception as e:
+ print("Skipping {} due to error: {}".format(bsp, e))
+ continue
+
bsps_sorted = sorted(bsps, key=lambda bsp: bsp.name.lower())
return bsps_sorted