From: stevenknight Date: Sun, 10 Feb 2002 12:58:31 +0000 (+0000) Subject: Allow the exported variables in an SConscript() call to be a UserList, too. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dce69fb1a7fc11e8cf1325a2a97ef5ae05ba2d39;p=scons.git Allow the exported variables in an SConscript() call to be a UserList, too. git-svn-id: http://scons.tigris.org/svn/scons/trunk@253 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index bb2c7adf..e77074ad 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -50,6 +50,9 @@ RELEASE 0.05 - - WIN32 portability fixes in tests. + - Allow the list of variables exported to an SConscript file to be + a UserList, too. + From Anthony Roach: - Make the scons script return an error code on failures. diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index de767ef3..7210bed6 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -28,14 +28,16 @@ files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/SConscript.py __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.Errors import SCons.Builder import SCons.Defaults +import SCons.Environment +import SCons.Errors import SCons.Node import SCons.Node.FS -import SCons.Environment +import SCons.Util + import string import sys @@ -61,7 +63,7 @@ class Frame: self.exports = {} # exports from the calling SConscript try: - if type(exports) == type([]): + if SCons.Util.is_List(exports): for export in exports: self.exports[export] = stack[-1].globals[export] else: diff --git a/test/SConscript.py b/test/SConscript.py index b60037f4..d9c7748c 100644 --- a/test/SConscript.py +++ b/test/SConscript.py @@ -65,6 +65,12 @@ foo = SConscript(script) assert foo == "subdir/SConscript foo" SConscript('SConscript5') + +import UserList +x7 = "SConstruct x7" +x8 = "SConstruct x8" +x9 = SConscript('SConscript6', UserList.UserList(["x7", "x8"])) +assert x9 == "SConscript6 x9" """) test.write('SConscript', """ @@ -87,7 +93,6 @@ Return("x3 x4") """) - test.write('SConscript2', """ Import("x1","x2") assert x1 == "SConstruct x1" @@ -149,6 +154,15 @@ S = Scanner(name = 'S', function = scan) A = Action("A") """) + +test.write('SConscript6', """ +Import("x7 x8") +assert x7 == "SConstruct x7" +assert x8 == "SConstruct x8" +x9 = "SConscript6 x9" +Return("x9") +""") + wpath = test.workpath() test.run(stdout = "SConstruct %s\nSConscript %s\n" % (wpath, wpath))