[Scons-users] Handling user supplied CPPPATH with Variables?

Marc Joliet marcec at gmx.de
Thu Jan 16 20:10:01 EST 2014


Am Fri, 17 Jan 2014 01:58:51 +0100
schrieb Marc Joliet <marcec at gmx.de>:


> Am Thu, 16 Jan 2014 13:23:52 -0500

> schrieb "Andrew C. Morrow" <andrew.c.morrow at gmail.com>:

>

> > Where I have declared a CPPPATH variable with AddVariables:

> >

> > cmdLineVars = Variables(None, ARGUMENTS)

> > cmdLineVars.AddVariables(

> > ('CPPPATH', 'Preprocessor search path')

> > )

> >

> > env = Environment(

> > variables=cmdLineVars,

> > )

>

> I believe you could replace

>

> ('CPPPATH', 'Preprocessor search path')

>

> with

>

> ('CPPPATH', 'Preprocessor search path', "", None, lambda s: s.split(','))

>

> The lambda is a converter passed to Add(). This is documented in the SCons man

> page under Add and AddVariables. I use "str.split" in one build system, for

> example, which is where I remembered this from.

>

> HTH


Ah, I'm so sorry, you mentioned you evaluated that option already (though made
no mention of actually trying it).

I can only stress the fact that my use of "converter" works in my build system,
so I think it's just a case of potentially confusing documentation. Here's what
it says:

"The converter must return a value,
which will be converted into a string before being validated by the validator
(if any) and then added to the environment."

It says it converts it to a string *before passing it to the validator* (if
any!). I think that as long as you don't use a validator (like I do), returning
a non-string should be no problem.

HTH
--
Marc Joliet
--
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://four.pairlist.net/pipermail/scons-users/attachments/20140117/2660b61a/attachment.pgp


More information about the Scons-users mailing list