From 66a4632f34028208921c48408cc089faebdf7671 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Mon, 5 Aug 2024 23:00:52 +0800 Subject: [PATCH] Fix python call in UF2 generation. (#4392) The call to generate UF2 files in the platformio custom script was a bare call to python. In some environments, this command won't exist in this way. Instead, use the standard env approach to find the right python. Additionally, add the shebang line on line 1 so this script can be executed standalone if needed. --- bin/platformio-custom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index 4f7ce55d0..b22d76098 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # trunk-ignore-all(ruff/F821) # trunk-ignore-all(flake8/F821): For SConstruct imports import sys @@ -80,7 +81,7 @@ if platform.name == "espressif32": if platform.name == "nordicnrf52": env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", - env.VerboseAction(f"python ./bin/uf2conv.py $BUILD_DIR/firmware.hex -c -f 0xADA52840 -o $BUILD_DIR/firmware.uf2", + env.VerboseAction(f"/usr/bin/env python3 ./bin/uf2conv.py $BUILD_DIR/firmware.hex -c -f 0xADA52840 -o $BUILD_DIR/firmware.uf2", "Generating UF2 file")) Import("projenv") @@ -95,4 +96,4 @@ projenv.Append( "-DAPP_VERSION=" + verObj["long"], "-DAPP_VERSION_SHORT=" + verObj["short"], ] -) \ No newline at end of file +)