[Scons-users] generating cpp defines with a function

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Tue Jun 2 11:01:04 EDT 2015


The code in _defines doesn't like that at all.

return [ [ 'ABC', 'ABC' ] ] 

Is fine (but wrong)

return [ { 'ABC' : 'ABC' } ] # or variants thereon

Gets this:

scons: *** [test.o] TypeError `get expected at least 1 arguments, got 0' trying to evaluate `${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}'


From: garyo at oberbrunner.com At: Jun  2 2015 15:48:07
To: Tom Tanner (BLOOMBERG/ LONDON), scons-users at scons.org
Subject: Re: [Scons-users] generating cpp defines with a function

Does it help if you return a dict (or convert your nested list to a dict)?
It may help if you look at the tests in test/CPPDEFINES (and if you see missing cases there, feel free to add them.)

On Tue, Jun 2, 2015 at 10:21 AM, Tom Tanner (BLOOMBERG/ LONDON) <ttanner2 at bloomberg.net> wrote:

I have a requirement to do something like this:

env.Append(CPPDEFINES = '${some_func(arg1, arg2)}')

My trouble comes when some_func returns something relatively complicated, like

[['FGH', 'string'], ['ABC', 'another string'], 'IJK' ]

This appears to get flattened and you get

gcc ... "-DFGH FGH ABC ABC IJK"

Which is very definitely not very helpful.

Is there anything I can do to get the return from some_func not to be flattened?


_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users


-- 
Gary

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150602/09dd0dba/attachment-0001.html>


More information about the Scons-users mailing list