- Allow access to both TARGET and SOURCE in $*PATH expansions.
- - Allow SConscript files to modify BUILD_TARGETS.
-
From Timothee Besset:
- Add support for Objective C/C++ .m and .mm file suffixes (for
- Have the Fortran module emitter look for Fortan modules to be created
relative to $FORTRANMODDIR, not the top-level directory.
+ - When saving Options to a file, run default values through the
+ converter before comparing them with the set values. This correctly
+ suppresses Boolean Option values from getting written to the saved
+ file when they're one of the many synonyms for a default True or
+ False value.
+
From Jeff Squyres:
- Documentation changes: Use $CPPDEFINES instead of $CCFLAGS in man
test = TestSCons.TestSCons()
cache_file = test.workpath('cached.options')
opts = SCons.Options.Options()
+
+ def bool_converter(val):
+ if val in [1, 'y']: val = 1
+ if val in [0, 'n']: val = 0
+ return val
# test saving out empty file
opts.Add('OPT_VAL',
default='foo')
opts.Add('OPT_VAL_3',
default=1)
+ opts.Add('OPT_BOOL_0',
+ default='n',
+ converter=bool_converter)
+ opts.Add('OPT_BOOL_1',
+ default='y',
+ converter=bool_converter)
+ opts.Add('OPT_BOOL_2',
+ default=0,
+ converter=bool_converter)
env = Environment()
opts.Update(env, {'OPT_VAL_3' : 2})
- assert env['OPT_VAL'] == 21
- assert env['OPT_VAL_2'] == 'foo'
- assert env['OPT_VAL_3'] == 2
+ assert env['OPT_VAL'] == 21, env['OPT_VAL']
+ assert env['OPT_VAL_2'] == 'foo', env['OPT_VAL_2']
+ assert env['OPT_VAL_3'] == 2, env['OPT_VAL_3']
+ assert env['OPT_BOOL_0'] == 0, env['OPT_BOOL_0']
+ assert env['OPT_BOOL_1'] == 1, env['OPT_BOOL_1']
+ assert env['OPT_BOOL_2'] == '0', env['OPT_BOOL_2']
+
env['OPT_VAL_2'] = 'bar'
+ env['OPT_BOOL_0'] = 0
+ env['OPT_BOOL_1'] = 1
+ env['OPT_BOOL_2'] = 2
+
opts.Save(cache_file, env)
checkSave(cache_file, { 'OPT_VAL_2' : 'bar',
- 'OPT_VAL_3' : 2 })
+ 'OPT_VAL_3' : 2,
+ 'OPT_BOOL_2' : 2})
# Test against some old bugs
class Foo:
# Convert stuff that has a repr() that
# cannot be evaluated into a string
value = SCons.Util.to_String(value)
- if env.subst('${%s}' % option.key) != \
- env.subst(SCons.Util.to_String(option.default)):
+
+ defaultVal = env.subst(SCons.Util.to_String(option.default))
+ if option.converter:
+ defaultVal = option.converter(defaultVal)
+
+ if str(env.subst('${%s}' % option.key)) != str(defaultVal):
fh.write('%s = %s\n' % (option.key, repr(value)))
except KeyError:
pass