I want to run a command in SCons which doesn't have any input/output files (actually the input and output are the same file). At the moment I am just manually running it with subprocess.Popen but is there a more SConsy way of doing it?
You can use the Command function to run whatever external command you run via Popen, and you can use the AlwaysBuild function to ensure your command is always run even if the target file exists. Scons doesn't like dependency cycles, so leave the source list empty.
myfile = env.Command('myfile.out', [], 'echo Hello world > $TARGETS')
env.AlwaysBuild(myfile)
The scons wiki also has a recipe for PhonyTargets which makes it easy to set up a lot of simple commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With