.I help
is the help text for the variable.
.I default
-is the default value of the variable.
+is the default value of the variable;
+if the default value is
+.B None
+and there is no explicit value specified,
+the construction variable will
+.I not
+be added to the construction environment.
.I validator
is called to validate the value of the variable, and should take three
arguments: key, value, and environment
- Allow Tool specifications to be passed a dictionary of keyword
arguments.
+ - Support an Options default value of None, in which case the variable
+ will not be added to the construction environment unless it's set
+ explicitly by the user or from an Options file.
+
From Chris Pawling:
- Have the linkloc tool use $MSVS_VERSION to select the Microsoft
env = Environment()
opts.Update(env, {})
assert not env.has_key('ANSWER')
-
+
+ # Test that a default value of None is all right.
+ test = TestSCons.TestSCons()
+ file = test.workpath('custom.py')
+ opts = SCons.Options.Options(file)
+
+ opts.Add('ANSWER',
+ "This is the answer",
+ None,
+ check)
+
+ env = Environment()
+ opts.Update(env, {})
+ assert not env.has_key('ANSWER')
+
def test_args(self):
"""Test updating an Environment with arguments overridden"""
# Finally validate the values:
for option in self.options:
- if option.validator:
+ if option.validator and values.has_key(option.key):
option.validator(option.key, env.subst('${%s}'%option.key), env)
def Save(self, filename, env):