Gary Oberbrunner avatar Gary Oberbrunner committed 523fe65 Merge

Merged in dirkbaechle/scons/issue2809 (pull request #14)

Comments (0)

Files changed (2)

doc/user/command-line.in

 
       <scons_example name="Variables1">
         <file name="SConstruct" printme="1">
-           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}'})
       <para>
 
       This &SConstruct; file first creates a &Variables; object
-      (the <literal>vars = Variables()</literal> call),
-      and then uses the object's &Add;
+      which uses the values from the command-line options dictionary &ARGUMENTS;
+      (the <literal>vars = Variables(None, ARGUMENTS)</literal> 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 <literal>0</literal>
       &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.
 
 
       <scons_example name="Variables_Help">
         <file name="SConstruct" printme="1">
-           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))
         <scons_output_command>scons -Q</scons_output_command>
       </scons_output>
 
+      <para>
+
+      Finally, you can combine both methods with:
+
+      </para>
+
+      <screen>
+        vars = Variables('custom.py', ARGUMENTS)
+      </screen>
+
+      <para>
+      
+      where values in the option file &custom_py; get overwritten
+      by the ones specified on the command line.
+
+      </para>
+      
     </section>
 
     <section>

doc/user/command-line.xml

       </para>
 
       <programlisting>
-           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}'})
       <para>
 
       This &SConstruct; file first creates a &Variables; object
-      (the <literal>vars = Variables()</literal> call),
-      and then uses the object's &Add;
+      which uses the values from the command-line options dictionary &ARGUMENTS;
+      (the <literal>vars = Variables(None, ARGUMENTS)</literal> 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 <literal>0</literal>
       &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.
 
       </para>
 
       <programlisting>
-           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))
         cc -o foo foo.o bar.o
       </screen>
 
+      <para>
+
+      Finally, you can combine both methods with:
+
+      </para>
+
+      <screen>
+        vars = Variables('custom.py', ARGUMENTS)
+      </screen>
+
+      <para>
+      
+      where values in the option file &custom_py; get overwritten
+      by the ones specified on the command line.
+
+      </para>
+
     </section>
 
     <section>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.