From: stevenknight Date: Tue, 15 Jan 2002 18:57:52 +0000 (+0000) Subject: Add Action() and Scanner() the list of global variables. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b17251b67fa7b3f787ae533c2db3a5c048b655a9;p=scons.git Add Action() and Scanner() the list of global variables. git-svn-id: http://scons.tigris.org/svn/scons/trunk@209 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 70e30be1..f87056fd 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -23,6 +23,9 @@ RELEASE 0.04 - - Function action fixes: None is now a successful return value. Exceptions are now reported. Document function actions. + - Add 'Action' and 'Scanner' to the global keywords so SConscript + files can use them too. + RELEASE 0.03 - Fri, 11 Jan 2002 01:09:30 -0600 diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index 4208ebaa..8ba64d1d 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -36,6 +36,7 @@ import SCons.Defaults import SCons.Node import SCons.Node.FS import SCons.Environment +import SCons.Scanner import SCons.Action import string import sys @@ -161,21 +162,23 @@ def BuildDefaultGlobals(): """ globals = {} - globals['Builder'] = SCons.Builder.Builder - globals['Environment'] = SCons.Environment.Environment - globals['Object'] = SCons.Defaults.Object - globals['Program'] = SCons.Defaults.Program - globals['Library'] = SCons.Defaults.Library - globals['CScan'] = SCons.Defaults.CScan - globals['SConscript'] = SConscript - globals['Default'] = Default - globals['Help'] = Help - globals['BuildDir'] = BuildDir - globals['GetBuildPath'] = GetBuildPath - globals['Export'] = Export - globals['Import'] = Import - globals['Return'] = Return - globals['Dir'] = SCons.Node.FS.default_fs.Dir - globals['File'] = SCons.Node.FS.default_fs.File + globals['Action'] = SCons.Action.Action + globals['BuildDir'] = BuildDir + globals['Builder'] = SCons.Builder.Builder + globals['CScan'] = SCons.Defaults.CScan + globals['Default'] = Default + globals['Dir'] = SCons.Node.FS.default_fs.Dir + globals['Environment'] = SCons.Environment.Environment + globals['Export'] = Export + globals['File'] = SCons.Node.FS.default_fs.File + globals['GetBuildPath'] = GetBuildPath + globals['Help'] = Help + globals['Import'] = Import + globals['Library'] = SCons.Defaults.Library + globals['Object'] = SCons.Defaults.Object + globals['Program'] = SCons.Defaults.Program + globals['Return'] = Return + globals['Scanner'] = SCons.Scanner.Base + globals['SConscript'] = SConscript globals['SetCommandHandler'] = SCons.Action.SetCommandHandler return globals diff --git a/test/SConscript.py b/test/SConscript.py index 496624d6..3e373ae6 100644 --- a/test/SConscript.py +++ b/test/SConscript.py @@ -63,6 +63,8 @@ subdir = Dir('subdir') script = File('SConscript', subdir) foo = SConscript(script) assert foo == "subdir/SConscript foo" + +SConscript('SConscript5') """) test.write('SConscript', """ @@ -138,6 +140,15 @@ foo = 'subdir/SConscript foo' Return('foo') """) + +test.write('SConscript5', """ +B = Builder(name = 'B', action = 'B') +def scan(): + pass +S = Scanner(name = 'S', function = scan) +A = Action("A") +""") + wpath = test.workpath() test.run(stdout = "SConstruct %s\nSConscript %s\n" % (wpath, wpath))