[Scons-users] Using Validators

Florian Lindner mailinglists at xgm.de
Fri Jul 18 05:16:35 EDT 2014


Hello,

I have a Variable with an validator:

vars.Add("compiler", "desc", "g++", validator=compiler_validator)

def compiler_validator(key, value, environment):
    if value in ["g++", "icc", "clang++"] or value.startswith("mpic"):
        return True
    else:
        return False


When called
scons [...] compiler=clang 
the function above is called and returns False. Despite of that the 
compilation starts...

When called
scons [...] compiler=foobar
is returns False too and the scons quits with the completely unrelated 
error:

Checking for C++ header file boost/array.hpp... no
ERROR: Header 'boost/array.hpp' (needed for Boost) not found or does not 
compile!

When called
scons [...] compiler=clang++
everything works.

I suppose that return False on invalidate values is correctly, the validator 
is undocumented and the API states only the arguments, not the return type 
and semantics.

Thanks!
Florian



More information about the Scons-users mailing list