Pre-build steps not executing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Pre-build steps not executing

跳至解决方案
1,737 次查看
Farnam
Contributor II

I have a python script to aggregative GIT info like commit and branch name, in the root directory of my project.
I want the script to execute as a pre-build step.

I go to Properties -> Settings -> Build Steps ... and enter the command to run the script with the `Release_FLASH` config"

cd.. python sample.py

However, the python script does not execute.
I tried creating a .bat file with the same execution instructions, but still no luck.

What am I missing here? Is there a flag I need to set somewhere? 

0 项奖励
回复
1 解答
1,702 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

If the file (.py or .bat) is not included inside the project and by project properties, try with the whole path to the file so it can be recognized, as such:

python "C:\User\user\Downloads\hello_world.py"

Julin_AragnM_0-1712943405922.png

I did a simple test with a hello world and it printed before finishing building:

Julin_AragnM_1-1712943413548.png

If this still does not work, try to add

cmd.exe

in front of your command line, so it launches the windows shell/command prompt.

Best regards,
Julián

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,703 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

If the file (.py or .bat) is not included inside the project and by project properties, try with the whole path to the file so it can be recognized, as such:

python "C:\User\user\Downloads\hello_world.py"

Julin_AragnM_0-1712943405922.png

I did a simple test with a hello world and it printed before finishing building:

Julin_AragnM_1-1712943413548.png

If this still does not work, try to add

cmd.exe

in front of your command line, so it launches the windows shell/command prompt.

Best regards,
Julián

0 项奖励
回复
1,659 次查看
Farnam
Contributor II

Hi @Julián_AragónM ,

Thank you!!

This may well have worked, so I'll mark it as the accepted answer.
However, I ended up doing the following work-around.

  1. Go to Properties  Builders
  2. Create a new builder, click "New..."
  3. Double click program
  4. Name the new builder
  5. Enter the location of the script
  6. Enter the working directory of the script
  7. Under refresh
    1. Select "Refresh resources upon completion."
    2. Then select "The selected resource"
  8. Select "After a "Clean"" (Optional)
  9. Select "During manual builds" (Optional)
  10. Then click "OK"
  11. Now click on the new builder and press the "Up" key until it is at the top of the list
1,647 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

Thank you for the workaround as well!

Best regards,
Julián

0 项奖励
回复