@@ -391,8 +391,8 @@ and can be used in the &SConscript; files to modify
391
391
the build in any way:</para >
392
392
393
393
<programlisting language =" python" >
394
- if ARGUMENTS.get(' debug', 0 ):
395
- env = Environment(CCFLAGS='-g' )
394
+ if ARGUMENTS.get(" debug", "" ):
395
+ env = Environment(CCFLAGS="-g" )
396
396
else:
397
397
env = Environment()
398
398
</programlisting >
@@ -401,8 +401,8 @@ else:
401
401
in the <link linkend =" v-ARGLIST" >&ARGLIST; </link > list,
402
402
indexed by their order on the command line.
403
403
This allows you to process them in order rather than by name,
404
- if necessary. Each &ARGLIST; entry is a tuple containing
405
- (< replaceable >argname</ replaceable >, < replaceable >argvalue</ replaceable >) .
404
+ if necessary. Each &ARGLIST; entry is a tuple consisting
405
+ of the name and the value .
406
406
</para >
407
407
408
408
<para >
@@ -3478,20 +3478,20 @@ include:</para>
3478
3478
<para >In addition to the global functions and methods,
3479
3479
&scons;
3480
3480
supports a number of variables
3481
- that can be used in &SConscript; files
3481
+ that can be used for run-time queries in &SConscript; files
3482
3482
to affect how you want the build to be performed.</para >
3483
3483
3484
3484
<variablelist >
3485
3485
<varlistentry id =" v-ARGLIST" >
3486
3486
<term >&ARGLIST; </term >
3487
3487
<listitem >
3488
3488
<para >A list of the
3489
- <emphasis >keyword </emphasis >=<emphasis >value</emphasis >
3490
- arguments specified on the command line.
3489
+ <emphasis >variable </emphasis >=<emphasis >value</emphasis >
3490
+ build variable arguments specified on the command line.
3491
3491
Each element in the list is a tuple
3492
- containing the argument .
3492
+ consisting of the variable and its value .
3493
3493
The separate
3494
- <emphasis >keyword </emphasis >
3494
+ <emphasis >variable </emphasis >
3495
3495
and
3496
3496
<emphasis >value</emphasis >
3497
3497
elements of the tuple
@@ -3501,41 +3501,54 @@ subscripting for elements
3501
3501
and
3502
3502
<emphasis role =" bold" >[1]</emphasis >
3503
3503
of the tuple, or, more readably, by using tuple unpacking.
3504
- Example :</para >
3504
+ Examples :</para >
3505
3505
3506
3506
<programlisting language =" python" >
3507
- print("first keyword , value =", ARGLIST[0][0], ARGLIST[0][1])
3508
- print("second keyword , value =", ARGLIST[1][0], ARGLIST[1][1])
3509
- key , value = ARGLIST[2]
3510
- print("third keyword , value =", key , value)
3511
- for key , value in ARGLIST:
3512
- # process key and value
3507
+ print("first variable , value =", ARGLIST[0][0], ARGLIST[0][1])
3508
+ print("second variable , value =", ARGLIST[1][0], ARGLIST[1][1])
3509
+ var , value = ARGLIST[2]
3510
+ print("third variable , value =", var , value)
3511
+ for var , value in ARGLIST:
3512
+ # process variable and value
3513
3513
</programlisting >
3514
+
3515
+ <para >
3516
+ The values obtained from &ARGLIST;
3517
+ (or from <link linkend =" v-ARGUMENTS" >&ARGUMENTS; </link >)
3518
+ are always strings since they originate from outside the &SCons; process.
3519
+ As "untrusted data",
3520
+ they should be validated before usage,
3521
+ and may need conversion to an appropriate type.
3522
+ </para >
3514
3523
</listitem >
3515
3524
</varlistentry >
3516
3525
3517
3526
<varlistentry id =" v-ARGUMENTS" >
3518
3527
<term >&ARGUMENTS; </term >
3519
3528
<listitem >
3520
3529
<para >A dictionary of all the
3521
- <emphasis >keyword </emphasis >=<emphasis >value</emphasis >
3522
- arguments specified on the command line.
3523
- The dictionary is not in order,
3524
- and if a given keyword has
3530
+ <emphasis >variable </emphasis >=<emphasis >value</emphasis >
3531
+ build variable arguments specified on the command line.
3532
+ The dictionary is in command-line order,
3533
+ so if a given variable has
3525
3534
more than one value assigned to it
3526
3535
on the command line,
3527
3536
the last (right-most) value is
3528
- the one in the &ARGUMENTS;
3537
+ the one saved in the &ARGUMENTS;
3529
3538
dictionary.</para >
3530
3539
3531
3540
<para >Example:</para >
3532
3541
3533
3542
<programlisting language =" python" >
3534
- if ARGUMENTS.get(' debug', 0 ):
3535
- env = Environment(CCFLAGS='-g' )
3543
+ if ARGUMENTS.get(" debug", "" ):
3544
+ env = Environment(CCFLAGS="-g" )
3536
3545
else:
3537
3546
env = Environment()
3538
3547
</programlisting >
3548
+
3549
+ <para >
3550
+ See also <link linkend =" v-ARGLIST" >&ARGLIST; </link >.
3551
+ </para >
3539
3552
</listitem >
3540
3553
</varlistentry >
3541
3554
@@ -3570,8 +3583,7 @@ list of targets specified using the
3570
3583
&Default; function,
3571
3584
the contents of the list may change
3572
3585
on each successive call to &Default; .
3573
- See the
3574
- &DEFAULT_TARGETS; list, below,
3586
+ See <link linkend =" v-DEFAULT_TARGETS" >&DEFAULT_TARGETS; </link >
3575
3587
for additional information.</para >
3576
3588
3577
3589
<para >Example:</para >
@@ -3590,12 +3602,13 @@ if 'special/program' in BUILD_TARGETS:
3590
3602
<listitem >
3591
3603
<para >A list of the targets explicitly specified on
3592
3604
the command line. If there are command line targets,
3593
- this list will have the same contents as &BUILD_TARGETS; .
3605
+ this list has the same contents as
3606
+ <link linkend =" v-BUILD_TARGETS" >&BUILD_TARGETS; </link >.
3594
3607
If there are no targets specified on the command line,
3595
3608
the list is empty. The elements of this list are strings.
3596
3609
This can be used, for example,
3597
3610
to take specific actions only
3598
- when certain targets are explicitly being built .</para >
3611
+ when a certain targets is explicitly requested for building .</para >
3599
3612
3600
3613
<para >Example:</para >
3601
3614
@@ -3617,7 +3630,7 @@ that have been specified using the
3617
3630
&f-link-Default;
3618
3631
function. If there are no command line
3619
3632
targets, this list will have the same contents as
3620
- &BUILD_TARGETS; .
3633
+ < link linkend = " v-BUILD_TARGETS " > &BUILD_TARGETS; </ link > .
3621
3634
Since the elements of the list are nodes,
3622
3635
you need to call the &Python;
3623
3636
<function >str</function >
@@ -4656,7 +4669,7 @@ env = conf.Finish()
4656
4669
<para >Often when building software,
4657
4670
specialized information needs to be conveyed at build time
4658
4671
to override the defaults in the build scripts.
4659
- Commandline arguments (like <literal >--implcit-cache</literal >)
4672
+ Command-line arguments (like <literal >--implcit-cache</literal >)
4660
4673
and giving names of build targets are two ways to do that.
4661
4674
Another is to provide variable-assignment arguments
4662
4675
on the command line.
@@ -4677,21 +4690,23 @@ Variables specified in the above way
4677
4690
can be manually processed by accessing the
4678
4691
<link linkend =" v-ARGUMENTS" >&ARGUMENTS; </link > dictionary
4679
4692
(or <link linkend =" v-ARGLIST" >&ARGLIST; </link > list),
4680
- but using a &Variables; object allows you to describe anticipated
4681
- variables and structure them into types with validation,
4682
- value conversion, defaults, help messages and aliases,
4683
- conceptually similar to the structure of options
4693
+ but using a &Variables; object allows you to describe
4694
+ anticipated variables,
4695
+ convert them to a suitable type if necessary,
4696
+ validate the values are within defined constraints,
4697
+ and define defaults, help messages and aliases.
4698
+ This is conceptually similar to the structure of options
4684
4699
(see &f-link-AddOption; ).
4685
- It also allows pulling variables from a saved
4686
- configuration file or a custom dictionary in an &SConscript; file.
4700
+ It also allows obtaining values from a saved variables file,
4701
+ or from a custom dictionary in an &SConscript; file.
4687
4702
The processed variables can then be applied to the desired &consenv; .
4688
4703
</para >
4689
4704
4690
4705
<para >
4691
- Conceptually , arguments are used to convey information to the
4706
+ Roughly speaking , arguments are used to convey information to the
4692
4707
&SCons; program about how it should behave;
4693
4708
variables are used to convey information to the build
4694
- (though the line between the two is certainly not absolute ).
4709
+ (although &SCons; does not enforce any such constraint ).
4695
4710
</para >
4696
4711
4697
4712
<para >To obtain an object for manipulating variables,
@@ -4731,8 +4746,8 @@ CC = os.environ.get('CC')
4731
4746
<para >If
4732
4747
<parameter >args</parameter >
4733
4748
is specified, it must be a dictionary.
4734
- The key-value pairs will be added to those
4735
- obtained from
4749
+ The key-value pairs from < parameter >args</ parameter >
4750
+ will be added to those obtained from
4736
4751
<parameter >files</parameter >, if any.
4737
4752
Keys from <parameter >args</parameter >
4738
4753
take precendence over same-named keys from <parameter >files</parameter >.
@@ -4799,7 +4814,7 @@ mechanism to define a variable which the user is
4799
4814
<emphasis >required</emphasis > to supply;
4800
4815
if necessary this can be implemented by accessing
4801
4816
<link linkend =" v-ARGUMENTS" >&ARGUMENTS; </link > directly,
4802
- although that only applies to the command- line,
4817
+ although that only applies to the command line,
4803
4818
not to any stored-values files.
4804
4819
</para >
4805
4820
@@ -4884,15 +4899,16 @@ vars.Add('COLOR', validator=valid_color)
4884
4899
<para >A convenience method that adds
4885
4900
one or more customizable &consvars;
4886
4901
to a &Variables; object in one call;
4887
- equivalent to calling &Add; multiple times.
4902
+ equivalent to calling
4903
+ <link linkend =' v-Add' ><function >Add</function ></link >
4904
+ multiple times.
4888
4905
The <parameter >args</parameter >
4889
4906
are tuples (or lists)
4890
4907
that contain the arguments
4891
4908
for an individual call to the &Add; method.
4892
4909
Since tuples are not &Python; mappings,
4893
4910
the arguments cannot use the keyword form,
4894
- but rather are positional arguments as documented for
4895
- <link linkend =' v-Add' ><function >Add</function ></link >:
4911
+ but rather are positional arguments as documented for &Add; :
4896
4912
a required name, the other four optional,
4897
4913
but must be in the specified order if used.
4898
4914
</para >
0 commit comments