[Scons-users] quoting question in an Action call
Christopher Murray
murpup at gmail.com
Fri Aug 2 13:20:36 EDT 2013
Hi,
I have a situation where my compiler is able, through a command line
argument, to write all of the diagnostics and warnings it produces to
a separate file. I would like to add a function to our build scripts
that is able to concatenate these individual diagnostic files into one
file. This would allow us to easily compare it to previous code
versions and detect newly added warnings or other issues. I could
create a separate script or python function which could be run at the
end of the build to do this, but I figured the most elegant solution
would be to do this with an Action object and AddPostAction.
So I created a Action object like this:
diag_action = env.Action([['cat', '${TARGET.dir}/*.diag', '>',
'diag_concat']])
env.AddPostAction(my_target, diag_action)
But when I run the build, the cat program throws the following error:
cat: build/cygwin/g95/x86/debug/src/*.diag: No such file or directory
Since all the .diag files do, in fact, exist in that build directory,
I figure that the "*" character must be getting interpreted literally
by the shell. I can replace the "*" with one of the actual file names
and it works just fine so it is not a relative path issue.
Is there a way to wrap the system call to 'cat' and its arguments to
prevent such quoting problems?
Thanks,
Chris
More information about the Scons-users
mailing list