From f545565f60f55af38e36f93ee9d75386aa0cd5d8 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Tue, 10 Jan 2012 21:49:24 +0100 Subject: - fix for issue #2809, corrected documentation for command-line variables --- doc/user/command-line.in | 28 +++++++++++++++++++++++----- doc/user/command-line.xml | 28 +++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/doc/user/command-line.in b/doc/user/command-line.in index abf8953..42f8e2e 100644 --- a/doc/user/command-line.in +++ b/doc/user/command-line.in @@ -885,7 +885,7 @@ - vars = Variables() + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) @@ -902,8 +902,9 @@ This &SConstruct; file first creates a &Variables; object - (the vars = Variables() call), - and then uses the object's &Add; + which uses the values from the command-line options dictionary &ARGUMENTS; + (the vars = Variables(None, ARGUMENTS) call). + It then uses the object's &Add; method to indicate that the &RELEASE; variable can be set on the command line, and that its default value will be 0 @@ -942,7 +943,7 @@ &PathOption;, &PackageOption; and &AddOptions;. These older names still work, and you may encounter them in older - &SConscript; fles, + &SConscript; files, but they have been officially deprecated as of &SCons; version 2.0. @@ -975,7 +976,7 @@ - vars = Variables('custom.py') + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars) Help(vars.GenerateHelpText(env)) @@ -1098,6 +1099,23 @@ scons -Q + + + Finally, you can combine both methods with: + + + + + vars = Variables('custom.py', ARGUMENTS) + + + + + where values in the option file &custom_py; get overwritten + by the ones specified on the command line. + + +
diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index 1bb84e2..49edf8a 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -875,7 +875,7 @@ - vars = Variables() + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) @@ -885,8 +885,9 @@ This &SConstruct; file first creates a &Variables; object - (the vars = Variables() call), - and then uses the object's &Add; + which uses the values from the command-line options dictionary &ARGUMENTS; + (the vars = Variables(None, ARGUMENTS) call). + It then uses the object's &Add; method to indicate that the &RELEASE; variable can be set on the command line, and that its default value will be 0 @@ -928,7 +929,7 @@ &PathOption;, &PackageOption; and &AddOptions;. These older names still work, and you may encounter them in older - &SConscript; fles, + &SConscript; files, but they have been officially deprecated as of &SCons; version 2.0. @@ -960,7 +961,7 @@ - vars = Variables('custom.py') + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars) Help(vars.GenerateHelpText(env)) @@ -1069,6 +1070,23 @@ cc -o foo foo.o bar.o + + + Finally, you can combine both methods with: + + + + + vars = Variables('custom.py', ARGUMENTS) + + + + + where values in the option file &custom_py; get overwritten + by the ones specified on the command line. + + +
-- cgit v0.12