.I SConstruct
file can specify subsidiary
configuration files using the
-.B SConscript()
+.BR SConscript ()
function.
By convention,
these subsidiary files are named
currently deprecated features.
These warnings are enabled by default.
Note that the
-.b --warn=no-deprecated
+.B --warn=no-deprecated
option does not disable warnings about absolutely all deprecated features.
Warnings for some deprecated features that have already been through
several releases with deprecation warnings
swig
tar
tex
+textfile
tlib
yacc
zip
that split a single string
into a list, separated on
strings of white-space characters.
-(These are similar to the
-string.split() method
-from the standard Python library,
+(These are similar to the split() member function of Python strings
but work even if the input isn't a string.)
Like all Python arguments,
env.Program(source = ['bar.c', 'foo.c'], target = 'bar')
env.Program(target = 'bar', Split('bar.c foo.c'))
env.Program(target = 'bar', env.Split('bar.c foo.c'))
-env.Program('bar', source = string.split('bar.c foo.c'))
+env.Program('bar', source = 'bar.c foo.c'.split())
.EE
Target and source file names
will over-write previous exports that have the same name.
Multiple variable names can be passed to
.BR Export ()
-as separate arguments or as a list. A dictionary can be used to map
-variables to a different name when exported. Both local variables and
-global variables can be exported.
+as separate arguments or as a list.
+Keyword arguments can be used to provide names and their values.
+A dictionary can be used to map variables to a different name when exported.
+Both local variables and global variables can be exported.
Examples:
# Make env and package available for all SConscript files:
Export(["env", "package"])
-# Make env available using the name debug:.
+# Make env available using the name debug:
+Export(debug = env)
+
+# Make env available using the name debug:
Export({"debug":env})
.EE
'\" .I src_dir
'\" arguments are interpreted relative to the directory of the calling
argument is interpreted relative to the directory of the calling
-.BR SConscript file.
+.B SConscript
+file.
See the description of the
.BR VariantDir ()
function below for additional details and restrictions.
If
-'\" .IR variant_dir " is present, but"
+.I variant_dir
+is present,
+'\" but
'\" .IR src_dir " is not,"
-.IR variant_dir " is present,"
-the source directory is relative to the called
-.BR SConscript " file."
+the source directory is the directory in which the
+.B SConscript
+file resides and the
+.B SConscript
+file is evaluated as if it were in the
+.I variant_dir
+directory:
.ES
SConscript('src/SConscript', variant_dir = 'build')
.EE
.EE
This later paradigm is often used when the sources are
in the same directory as the
-.BR SConstruct file:
+.BR SConstruct:
.ES
SConscript('SConscript', variant_dir = 'build')
.EE
.ES
env.SetDefault(FOO = 'foo')
-if not env.has_key('FOO'): env['FOO'] = 'foo'
+if 'FOO' not in env: env['FOO'] = 'foo'
.EE
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
def validate_color(key, val, env):
if not val in ['red', 'blue', 'yellow']:
- raise "Invalid color value '%s'" % val
+ raise Exception("Invalid color value '%s'" % val)
vars.Add('COLOR', validator=valid_color)
.EE
.P
.ES
-b = Builder("build_it < $SOURCE > $TARGET"
+b = Builder("build_it < $SOURCE > $TARGET",
prefix = "file-")
def gen_prefix(env, sources):
.IP single_source
Specifies that this builder expects exactly one source file per call. Giving
-more than one source files without target files results in implicitely calling
+more than one source file without target files results in implicitely calling
the builder multiple times (once for each source given). Giving multiple
source files together with target files results in a UserError exception.
def pf(env, dir, target, source, arg):
top_dir = Dir('#').abspath
results = []
- if env.has_key('MYPATH'):
+ if 'MYPATH' in env:
for p in env['MYPATH']:
results.append(top_dir + os.sep + p)
return results