[Scons-users] generating cpp defines with a function
Kenny, Jason L
jason.l.kenny at intel.com
Tue Jun 2 11:09:33 EDT 2015
The issue is in subst().
The code that subst a list assumes a 1:1 mapping of a given item in the list so it assumes that given:
[‘$sayit’,’$foo’]
The current code assume that “$sayit” return a value like “hello” it does not assume that [‘hello’,’world’] would be returned.
So it replaces [‘$sayit’] with [[‘hello’,’world’],’fooval’] instead of what the desired [‘hello’,’world’,’fooval’].
Jason
From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Tom Tanner (BLOOMBERG/ LONDON)
Sent: Tuesday, June 2, 2015 10:01 AM
To: scons-users at scons.org
Subject: Re: [Scons-users] generating cpp defines with a function
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<mailto:garyo at oberbrunner.com> At: Jun 2 2015 15:48:07
To: Tom Tanner (BLOOMBERG/ LONDON)<mailto:ttanner2 at bloomberg.net>, scons-users at scons.org<mailto: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<mailto: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<mailto: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/aa475ff0/attachment.html>
More information about the Scons-users
mailing list