[Scons-users] quoting question in an Action call

David Roundy roundyd at physics.oregonstate.edu
Sun Aug 4 08:42:44 EDT 2013


I expect

diag_action = env.Action('cat ${TARGET.dir}/*.diag > diag_concat')

would work (as long as ${TARGET.dir} does not contain spaces, '>', or other
shell-specific characters. Specifying an action as a list presumably
bypasses the shell, as that's what it does in most other languages.

David


On Fri, Aug 2, 2013 at 10:20 AM, Christopher Murray <murpup at gmail.com>wrote:


> 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

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>




--
David Roundy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20130804/bb31f3e1/attachment.html


More information about the Scons-users mailing list