.IR options ...
]
[
+.IR name = val ...
+]
+[
.IR targets ...
]
.SH DESCRIPTION
builds four targets in parallel, for example.
-.\" Values of variables to be passed to the configuration file(s)
-.\" may be specified on the command line:
-.\"
-.\" .ES
-.\" scons debug=1 .
-.\" .EE
-.\"
-.\" These variables can be used in the configuration file(s) to modify
-.\" the build in any way.
-.\"
+Values of variables to be passed to the configuration file(s)
+may be specified on the command line:
+
+.ES
+scons debug=1 .
+.EE
+
+These variables can be used in the configuration file(s) to modify
+the build in any way.
+
.\" .B scons
.\" can maintain a cache of target (derived) files that can
.\" be shared between multiple builds. When caching is enabled in a
import SCons.Node
import SCons.Node.FS
import SCons.Environment
-import SCons.Scanner
-import SCons.Action
import string
import sys
default_targets = []
print_help = 0
+arguments = {}
# global exports set by Export():
global_exports = {}
+def _scons_add_args(alist):
+ global arguments
+ for arg in alist:
+ a, b = string.split(arg, '=', 2)
+ arguments[a] = b
+
class Frame:
"""A frame on the SConstruct/SConscript call stack"""
def __init__(self, exports):
globals = {}
globals['Action'] = SCons.Action.Action
+ globals['ARGUMENTS'] = arguments
globals['BuildDir'] = BuildDir
globals['Builder'] = SCons.Builder.Builder
globals['CScan'] = SCons.Defaults.CScan
opt_func[opt](opt, arg)
try:
- cmd_opts, targets = getopt.getopt(sys.argv[1:], short_opts, long_opts)
+ cmd_opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
except getopt_err, x:
_scons_user_error(x)
else:
for opt, arg in cmd_opts:
opt_func[opt](opt, arg)
+ xmit_args = []
+ for a in args:
+ if '=' in a:
+ xmit_args.append(a)
+ else:
+ targets.append(a)
+ SCons.Script.SConscript._scons_add_args(xmit_args)
if not scripts:
for file in ['SConstruct', 'Sconstruct', 'sconstruct']:
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright (c) 2002 Steven Knight
+#
+# 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', """
+foo = open('foo.out', 'w')
+keys = ARGUMENTS.keys()
+keys.sort()
+for k in keys:
+ foo.write(k + " = " + ARGUMENTS[k] + "\\n")
+foo.close()
+""")
+
+test.run(arguments='a=1 bz=3 xx=sd')
+
+test.fail_test(test.read('foo.out') != """a = 1
+bz = 3
+xx = sd
+""")
+
+test.pass_test()