SCons / test / option-j.py

Diff from to

test/option-j.py

 import sys
 import TestSCons
 
-python = TestSCons.python
+_python_ = TestSCons._python_
 
 try:
     import threading
 """)
 
 test.write('SConstruct', """
-MyBuild = Builder(action = r'%s build.py $TARGETS')
+MyBuild = Builder(action = r'%(_python_)s build.py $TARGETS')
 env = Environment(BUILDERS = { 'MyBuild' : MyBuild })
 env.MyBuild(target = 'f1', source = 'f1.in')
 env.MyBuild(target = 'f2', source = 'f2.in')
                 source='foo/foo.in',
                 action=copyn)
 env.Install('out', t)
-""" % python)
+""" % locals())
 
 def RunTest(args, extra):
     """extra is used to make scons rebuild the output file"""
 
 # Test SetJobs() with no -j:
 test.write('SConstruct', """
-MyBuild = Builder(action = r'%s build.py $TARGETS')
+MyBuild = Builder(action = r'%(_python_)s build.py $TARGETS')
 env = Environment(BUILDERS = { 'MyBuild' : MyBuild })
 env.MyBuild(target = 'f1', source = 'f1.in')
 env.MyBuild(target = 'f2', source = 'f2.in')
 assert GetOption('num_jobs') == 1
 SetOption('num_jobs', 2)
 assert GetOption('num_jobs') == 2
-""" % python)
+""" % locals())
 
 # This should be a parallel build because the SConscript sets jobs to 2.
 # fail if the second file was not started
 
 # Test SetJobs() with -j:
 test.write('SConstruct', """
-MyBuild = Builder(action = r'%s build.py $TARGETS')
+MyBuild = Builder(action = r'%(_python_)s build.py $TARGETS')
 env = Environment(BUILDERS = { 'MyBuild' : MyBuild })
 env.MyBuild(target = 'f1', source = 'f1.in')
 env.MyBuild(target = 'f2', source = 'f2.in')
 assert GetOption('num_jobs') == 1
 SetOption('num_jobs', 2)
 assert GetOption('num_jobs') == 1
-""" % python)
+""" % locals())
 
 # This should be a serial build since -j 1 overrides the call to SetJobs().
 # fail if the second file was started
 """)
 
 test.write('SConstruct', """
-MyCopy = Builder(action = r'%s mycopy.py $TARGET $SOURCE')
-Fail = Builder(action = r'%s myfail.py $TARGETS $SOURCE')
+MyCopy = Builder(action = r'%(_python_)s mycopy.py $TARGET $SOURCE')
+Fail = Builder(action = r'%(_python_)s myfail.py $TARGETS $SOURCE')
 env = Environment(BUILDERS = { 'MyCopy' : MyCopy, 'Fail' : Fail })
 env.Fail(target = 'f3', source = 'f3.in')
 env.MyCopy(target = 'f4', source = 'f4.in')
 env.MyCopy(target = 'f5', source = 'f5.in')
 env.MyCopy(target = 'f6', source = 'f6.in')
-""" % (python, python))
+""" % locals())
 
 test.write('f3.in', "f3.in\n")
 test.write('f4.in', "f4.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.