I have a Python 3.5 script that I would like to invoke as a pre-build step in my Code Composer build. To be clear, it should be run as one of the entries in (my project) > Properties > CCS Build > Steps > Pre-build steps.
The script currently begins with the hashbang #!/usr/bin/env python3
, but I can change this.
On Linux, I can invoke the script as ../prebuild.py ../output_file
. This fails on Windows 10 with:
"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
../prebuild.py ../output_file
makefile:217: recipe for target 'pre-build' failed
process_begin: CreateProcess(NULL, env python3 C:\path\to\prebuild.py ../output_file, ...) failed.
make (e=2): The system cannot find the file specified.
The path separator does not affect this at all.
I also tried python3 ../prebuild.py ../output_file
. This does not work on Windows 10 because there is no python3
executable. Python 3 is installed as python.exe
. Using python
fails on Linux because of course Python 3 is installed as python3
, and python
refers to Python 2.
I also tried py ../prebuild.py ../output_file
. This fails on Linux because there is no py
executable.
Is there a cross-platform way to invoke a Python 3 script that can be used for an Eclipse pre-build step? I would like to avoid requiring that developers modify their distribution/Python installation.
I am using Code Composer Studio 6, which is based on Eclipse. I expect any answer to this would apply to either.
Context
One of the things I am trying to achieve is to insert the SHA1 of the current Git commit into a file. The accepted answer for doing this is to generate the file as part of the build process by parsing Git output. I have a Python script that can do this on both Windows and Linux, so I need a way to invoke it as part of Eclipse's build process.