summaryrefslogtreecommitdiff
path: root/tools/autobuild/build-downloads.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-09-28 15:26:23 +1000
committerDamien George <damien@micropython.org>2023-09-29 14:18:33 +1000
commit88ecc78eb30aaea395c3e97ea097d6194a1f0baf (patch)
tree2bb02d1d95467bd8e02777b6bcb0f7238cf59f4d /tools/autobuild/build-downloads.py
parentcf32c2feb519367e1f6ca1d6ed146269022090aa (diff)
tools/autobuild/build-downloads.py: Verify standard features.
Defines the list of standard features and ensures that each board.json only uses those ones. This list can be extended, but needs to be a deliberate decision. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tools/autobuild/build-downloads.py')
-rwxr-xr-xtools/autobuild/build-downloads.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/autobuild/build-downloads.py b/tools/autobuild/build-downloads.py
index 0f532e8bf..c03d98aa5 100755
--- a/tools/autobuild/build-downloads.py
+++ b/tools/autobuild/build-downloads.py
@@ -5,6 +5,42 @@ import json
import os
import sys
+VALID_FEATURES = {
+ # Connectivity
+ "BLE",
+ "CAN",
+ "Ethernet",
+ "LoRa",
+ "USB",
+ "USB-C",
+ "WiFi",
+ # MCU features
+ "Dual-core",
+ "External Flash",
+ "External RAM",
+ # Form factor
+ "Feather",
+ # Connectors / sockets
+ "JST-PH",
+ "JST-SH",
+ "mikroBUS",
+ "microSD",
+ "SDCard",
+ # Sensors
+ "Environment Sensor",
+ "IMU",
+ # Other
+ "Audio Codec",
+ "Battery Charging",
+ "Camera",
+ "DAC",
+ "Display",
+ "Microphone",
+ "PoE",
+ "RGB LED",
+ "Secure Element",
+}
+
def main(repo_path, output_path):
boards_index = []
@@ -19,6 +55,16 @@ def main(repo_path, output_path):
with open(board_json, "r") as f:
blob = json.load(f)
+ features = set(blob.get("features", []))
+ if not features.issubset(VALID_FEATURES):
+ print(
+ board_json,
+ "unknown features:",
+ features.difference(VALID_FEATURES),
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
# Use "id" if specified, otherwise default to board dir (e.g. "PYBV11").
# We allow boards to override ID for the historical build names.
blob["id"] = blob.get("id", os.path.basename(board_dir))