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.
This commit is contained in:
Tom Fifield 2024-08-05 23:00:52 +08:00 committed by GitHub
parent e509a91019
commit 66a4632f34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
# trunk-ignore-all(ruff/F821) # trunk-ignore-all(ruff/F821)
# trunk-ignore-all(flake8/F821): For SConstruct imports # trunk-ignore-all(flake8/F821): For SConstruct imports
import sys import sys
@ -80,7 +81,7 @@ if platform.name == "espressif32":
if platform.name == "nordicnrf52": if platform.name == "nordicnrf52":
env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", 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")) "Generating UF2 file"))
Import("projenv") Import("projenv")