[Scons-users] CPPDEFINES Unexpected Behavior

Dirk Bächle tshortik at gmx.de
Wed Apr 10 15:34:36 EDT 2013


Hi Kyle,

On 10.04.2013 20:51, Strand, Kyle J wrote:

> Some additional information:

>

> [...]

> I've discovered some really surprising and probably incorrect behavior

> with the environment's CPPDEFINES variable. According to the manpage,

>

> [...]

>

> This leads me to expect that if I use env.AppendUnique() with a

> dictionary argument, if any of the values in that dictionary are None,

> then the corresponding keys will be defined without an explicit value.

> However, this is not what happens. The following code:

>

> env = Environment()

> newdefs = {'def1':None}

> env.AppendUnique(CPPDEFINES=newdefs)

>

> causes 'def1' to be defined *as the literal string 'None.'

>

> *Is this the desired behavior? If so, why? If not, I'll submit a bug

> report.

>


I'm not sure what the desired behaviour is, but this is what the code
does: the replacement methods for the CPPDEFINES variable expect the
prefix and suffix to be of type str(ing). That's what the function
_concat_ixes(prefix, list, suffix, env) in Defaults.py tries to ensure
by wrapping the prefix/suffix arguments in a str() call each. And this
returns the 'None' in your example.

Does the workaround

newdefs = {'def1' : ''}

(defining an empty string) give you the desired result?

Best regards,

Dirk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130410/ceb01c56/attachment.html>


More information about the Scons-users mailing list