env = Environment()
.EE
+The command-line variable arguments are also available
+in the ARGLIST list,
+indexed by their order on the command line.
+This allows you to process them in order rather than by name,
+if necessary.
+ARGLIST[0] returns a tuple
+containing (argname, argvalue).
+A Python exception is thrown if you
+try to access a list member that
+does not exist.
+
.B scons
requires Python version 1.5.2 or later.
There should be no other dependencies or requirements to run
that can be used in SConscript files
to affect how you want the build to be performed.
+'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.TP
+ARGLIST
+A list
+.IR keyword = value
+arguments specified on the command line.
+Each element in the list is a tuple
+containing the
+.RI ( keyword , value )
+of the argument.
+The separate
+.I keyword
+and
+.I value
+elements of the tuple
+can be accessed by
+subscripting for element
+.B [0]
+and
+.B [1]
+of the tuple, respectively.
+
+.ES
+print "first keyword, value =", ARGLIST[0][0], ARGLIST[0][1]
+print "second keyword, value =", ARGLIST[1][0], ARGLIST[1][1]
+third_tuple = ARGLIST[2]
+print "third keyword, value =", third_tuple[0], third_tuple[1]
+for key, value in ARGLIST:
+ # process key and value
+.EE
+
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
ARGUMENTS
- Suppress null values in construction variables like $LIBS that use
the internal _concat() function.
+ - Remove .dll files from the construction variables searched for
+ libraries that can be fed to Win32 compilers.
+
From Chad Austin and Christoph Wiedemann:
- Add support for a $RPATH variable to supply a list of directories
- Try to find the ICL license file path name in the external environment
and the registry before resorting to the hard-coded path name.
+ - Add support for fetching command-line keyword=value arguments in
+ order from an ARGLIST list.
+
From Simon Perkins:
- Fix a bug introduced in building shared libraries under MinGW.
- If Visual Studio is installed, assume the C/C++ compiler, the linker
and the MIDL compiler that comes with it are available, too.
+ - Better error messages when evaluating a construction variable
+ expansion yields a Python syntax error.
+
From sam th:
- Allow SConf.CheckLib() to search a list of libraries, like the
HelpFunction = do_nothing
Arguments = {}
+ArgList = []
CommandLineTargets = []
DefaultCalled = None
DefaultTargets = []
for arg in alist:
a, b = string.split(arg, '=', 1)
Arguments[a] = b
+ ArgList.append((a, b))
def _scons_add_targets(tlist):
if tlist:
# Other variables we provide.
'ARGUMENTS' : Arguments,
+ 'ARGLIST' : ArgList,
'BUILD_TARGETS' : BuildTargets,
'COMMAND_LINE_TARGETS' : CommandLineTargets,
'DEFAULT_TARGETS' : DefaultTargets,
--- /dev/null
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+i = 0
+for key, value in ARGLIST:
+ print "%d: %s = %s" % (i, key, value)
+ i = i + 1
+""")
+
+expect = test.wrap_stdout(read_str="""\
+0: a = 1
+1: bz = 3
+2: xx = sd
+3: zzz = foo=bar
+""",
+ build_str="scons: `.' is up to date.\n")
+
+test.run(arguments='a=1 bz=3 xx=sd zzz=foo=bar .', stdout = expect)
+
+test.pass_test()