Run command in SCons without dependencies

I want to run a command in SCons that has no input / output files (in fact, the input and output are the same file). Right now I am just running it using subprocess.Popen, but is there any other way for SConsy to do this?

+8
scons
source share
1 answer

You can use the Command function to run any external command that you run through Popen, and you can use AlwaysBuild to ensure that your command always runs, even if the target file exists. Scons does not like dependency loops, so leave the original list empty.

myfile = env.Command('myfile.out', [], 'echo Hello world > $TARGETS') env.AlwaysBuild(myfile) 

The scons wiki also has a PhonyTargets recipe that makes it easy to configure many simple commands.

+13
source share

All Articles