Source

SCons / test / Default.py

Diff from to

test/Default.py

 import sys
 import TestSCons
 
-python = TestSCons.python
+_python_ = TestSCons._python_
 
 test = TestSCons.TestSCons()
 
 
 #
 test.write(['one', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'foo.out', source = 'foo.in')
 env.B(target = 'bar.out', source = 'bar.in')
 Default('foo.out')
-""" % python)
+""" % locals())
 
 test.write(['two', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'foo.out', source = 'foo.in')
 env.B(target = 'bar.out', source = 'bar.in')
 Default('foo.out', 'bar.out')
-""" % python)
+""" % locals())
 
 test.write(['three', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'foo.out', source = 'foo.in')
 env.B(target = 'bar.out', source = 'bar.in')
 Default(Split('foo.out bar.out'))
-""" % python)
+""" % locals())
 
 test.write(['four', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = ['foo bar'], source = 'foo.in')
 env.B(target = 'foo', source = 'foo.in')
 env.B(target = 'bar', source = 'bar.in')
 Default(['foo bar'])
-""" % python)
+""" % locals())
 
 test.write(['five', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 Default(env.B(target = 'foo.out', source = 'foo.in'))
 Default(env.B(target = 'bar.out', source = 'bar.in'))
-""" % python)
+""" % locals())
 
 
 for dir in ['one', 'two', 'three', 'four', 'five']:
 
 # Test how a None Default() argument works to disable/reset default targets.
 test.write(['six', 'SConstruct'], """\
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 foo = env.B(target = 'foo.out', source = 'foo.in')
 bar = env.B(target = 'bar.out', source = 'bar.in')
 Default(None)
-""" % python)
+""" % locals())
 
 test.run(chdir = 'six', status = 2, stderr =
 "scons: *** No targets specified and no Default() targets found.  Stop.\n")
 
 test.write(['seven', 'SConstruct'], """\
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 foo = env.B(target = 'foo.out', source = 'foo.in')
 bar = env.B(target = 'bar.out', source = 'bar.in')
 Default(foo, bar, None)
-""" % python)
+""" % locals())
 
 test.run(chdir = 'seven', status = 2, stderr =
 "scons: *** No targets specified and no Default() targets found.  Stop.\n")
 
 test.write(['eight', 'SConstruct'], """\
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 foo = env.B(target = 'foo.out', source = 'foo.in')
 bar = env.B(target = 'bar.out', source = 'bar.in')
 Default(foo, None, bar)
-""" % python)
+""" % locals())
 
 test.run(chdir = 'eight')       # no arguments, use the Default
 
 test.subdir('nine', ['nine', 'sub1'])
 
 test.write(['nine', 'SConstruct'], """\
-B = Builder(action = r'%s build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'xxx.out', source = 'xxx.in')
 SConscript('sub1/SConscript')
-""" % python)
+""" % locals())
 
 test.write(['nine', 'xxx.in'], "xxx.in\n")
 
 test.write(['nine', 'sub1', 'SConscript'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'xxx.out', source = 'xxx.in')
 Default('xxx.out')
-""" % python)
+""" % locals())
 
 test.write(['nine', 'sub1', 'xxx.in'], "sub1/xxx.in\n")
 
 
 test.write(['ten', 'SConstruct'], """\
 Default('sub2')
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'xxx.out', source = 'xxx.in')
 SConscript('sub2/SConscript')
-""" % python)
+""" % locals())
 
 test.write(['ten', 'xxx.in'], "xxx.in\n")
 
 test.write(['ten', 'sub2', 'SConscript'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'xxx.out', source = 'xxx.in')
-""" % python)
+""" % locals())
 
 test.write(['ten', 'sub2', 'xxx.in'], "sub2/xxx.in\n")
 
 test.subdir('eleven')
 
 test.write(['eleven', 'SConstruct'], """
-B = Builder(action = r'%s ../build.py $TARGET $SOURCES')
+B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
 env = Environment(BUILDERS = { 'B' : B }, XXX = 'foo.out')
 env.B(target = 'foo.out', source = 'foo.in')
 env.B(target = 'bar.out', source = 'bar.in')
 env.Default('$XXX')
-""" % python)
+""" % locals())
 
 test.write(os.path.join('eleven', 'foo.in'), "eleven/foo.in\n");
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.