summaryrefslogtreecommitdiff
path: root/tools/autobuild/build-downloads.py
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-01-07 14:19:11 +1100
committerDamien George <damien@micropython.org>2025-01-17 16:03:45 +1100
commitd89e71e6c08b7dff21967868887f4503fc8ac5aa (patch)
treebfc2ea6297c955afcd79f035581a8c419e2ee209 /tools/autobuild/build-downloads.py
parentb6649b922e0ff7fa263b05d560f4c11a3910d1d9 (diff)
tools/autobuild,esp32: Template the generation of esp32 port deploy.md.
Allows two source files (ports/esp32/boards/deploy.md and deploy_nativeusb.md for boards with only native USB) for all esp32 installation steps, with templated chip name and flash offset inserted via string formatting. The new files add more text to explain the esptool.py port auto-detection, remove the unnecessary -z feature (already enabled by default), and add a bit of troubleshooting and port detection info. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'tools/autobuild/build-downloads.py')
-rwxr-xr-xtools/autobuild/build-downloads.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/autobuild/build-downloads.py b/tools/autobuild/build-downloads.py
index d6f6d0324..f7411f598 100755
--- a/tools/autobuild/build-downloads.py
+++ b/tools/autobuild/build-downloads.py
@@ -91,7 +91,18 @@ def main(repo_path, output_path):
f.write("\n\n## Installation instructions\n")
for deploy in blob["deploy"]:
with open(os.path.join(board_dir, deploy), "r") as fin:
- f.write(fin.read())
+ body = fin.read()
+ # any key in the board.json file can be substituted via Python str.format()
+ try:
+ body = body.format(**blob)
+ except Exception as e:
+ raise RuntimeError(
+ "Failed to format deploy file {} according to {}: {}".format(
+ fin.name, board_json, e
+ )
+ )
+ f.write(body)
+ f.write("\n")
# Write the full index for the website to load.
with open(os.path.join(output_path, "index.json"), "w") as f: