Skip to content

Pre/Post Actions on buildprog not called #5119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
seby42 opened this issue Mar 25, 2025 · 2 comments
Open

Pre/Post Actions on buildprog not called #5119

seby42 opened this issue Mar 25, 2025 · 2 comments

Comments

@seby42
Copy link

seby42 commented Mar 25, 2025

Trying to use pre-/post-action hooks but can't figure out what I'm missing

platformio.ini:

[env]
board = cubecell_module_plus
framework = arduino
platform = heltec-cubecell
extra_scripts = pre:${PROJECT_DIR}/scripts/extra_script.py

extra_script.py:

Import("env")

print("This will be called")

def test(source, target, env):
    print("This will never be called")

def test2(source, target, env):
    print("This will never be called")

env.AddPreAction("buildprog", test)
env.AddPostAction("buildprog", test2)

output:

extra_scripts: pre:/Users/sebastien/Documents/PlatformIO/Projects/test/scripts/extra_script.py)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
This will be called
CONFIGURATION: https://docs.platformio.org/page/boards/heltec-cubecell/cubecell_module_plus.html
PLATFORM: Heltec CubeCell (1.1.0) > Heltec CubeCell-Module Plus (HTCC-AM02)
@ivankravets
Copy link
Member

The buildprog target is available in the POST-typre script. Please change to extra_scripts = post:$

@seby42
Copy link
Author

seby42 commented Mar 25, 2025

So if I want to run a script before the build I need to add POST-type script with a PREAction hook?

I'm trying to make sense of the —really— confusing doc here: https://docs.platformio.org/en/latest/scripting/actions.html


#
# Custom actions when building program/firmware
#

env.AddPreAction("buildprog", callback...)
env.AddPostAction("buildprog", callback...)

@ivankravets ivankravets added this to the 6.1.19 milestone Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants