summaryrefslogtreecommitdiffstats
path: root/test/explain/basic.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/explain/basic.py')
-rw-r--r--test/explain/basic.py99
1 files changed, 50 insertions, 49 deletions
diff --git a/test/explain/basic.py b/test/explain/basic.py
index 881f01d..fec7b93 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -37,6 +37,9 @@ test = TestSCons.TestSCons()
test.subdir(['src'], ['src', 'subdir'])
+python = TestSCons.python
+_python_ = TestSCons._python_
+
subdir_file7 = os.path.join('subdir', 'file7')
subdir_file7_in = os.path.join('subdir', 'file7.in')
subdir_file8 = os.path.join('subdir', 'file8')
@@ -75,8 +78,6 @@ for f in sys.argv[2:]:
sys.exit(0)
""")
-test.chmod(cat_py, 0755)
-
SConstruct_contents = """\
import re
@@ -93,8 +94,8 @@ kscan = Scanner(name = 'kfile',
argument = None,
skeys = ['.k'])
-cat = Builder(action = [[r'%(cat_py)s', '$TARGET', '$SOURCES']])
-one_cat = Builder( action = [[r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']])
+cat = Builder(action = [[r'%(_python_)s', r'%(cat_py)s', '$TARGET', '$SOURCES']])
+one_cat = Builder( action = [[r'%(_python_)s', r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']])
env = Environment()
env.Append(BUILDERS = {'Cat':cat, 'OneCat':one_cat},
@@ -118,7 +119,7 @@ env.Cat('file1', 'file1.in')
env.Cat('file2', 'file2.k')
env.Cat('file3', ['xxx', 'yyy', 'zzz'])
env.Command('file4', 'file4.in',
- r'%(cat_py)s $TARGET $FILE4FLAG $SOURCES',
+ r'%(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES',
FILE4FLAG='-')
env.Cat('file5', 'file5.k')
file6 = env.Cat('file6', 'file6.in')
@@ -176,13 +177,13 @@ args = '--debug=explain .'
expect = test.wrap_stdout("""\
scons: building `file1' because it doesn't exist
-%(cat_py)s file1 file1.in
+%(_python_)s %(cat_py)s file1 file1.in
scons: building `file2' because it doesn't exist
-%(cat_py)s file2 file2.k
+%(_python_)s %(cat_py)s file2 file2.k
scons: building `file3' because it doesn't exist
-%(cat_py)s file3 xxx yyy zzz
+%(_python_)s %(cat_py)s file3 xxx yyy zzz
scons: building `file4' because it doesn't exist
-%(cat_py)s file4 - file4.in
+%(_python_)s %(cat_py)s file4 - file4.in
scons: building `%(inc_aaa)s' because it doesn't exist
Install file: "aaa" as "%(inc_aaa)s"
scons: building `%(inc_ddd)s' because it doesn't exist
@@ -192,15 +193,15 @@ Install file: "eee.in" as "%(inc_eee)s"
scons: building `%(inc_bbb_k)s' because it doesn't exist
Install file: "bbb.k" as "%(inc_bbb_k)s"
scons: building `file5' because it doesn't exist
-%(cat_py)s file5 file5.k
+%(_python_)s %(cat_py)s file5 file5.k
scons: building `file6' because it doesn't exist
-%(cat_py)s file6 file6.in
+%(_python_)s %(cat_py)s file6 file6.in
scons: building `%(subdir_file7)s' because it doesn't exist
-%(cat_py)s %(subdir_file7)s %(subdir_file7_in)s
+%(_python_)s %(cat_py)s %(subdir_file7)s %(subdir_file7_in)s
scons: building `%(subdir_file8)s' because it doesn't exist
-%(cat_py)s %(subdir_file8)s %(subdir_file7_in)s
+%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s
scons: building `%(subdir_file9)s' because it doesn't exist
-%(cat_py)s %(subdir_file9)s %(subdir_file7_in)s
+%(_python_)s %(cat_py)s %(subdir_file9)s %(subdir_file7_in)s
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -237,26 +238,26 @@ WriteInitialTest( locals() )
expect = test.wrap_stdout("""\
scons: rebuilding `file1' because `file1.in' changed
-%(cat_py)s file1 file1.in
+%(_python_)s %(cat_py)s file1 file1.in
scons: rebuilding `file2' because `yyy' changed
-%(cat_py)s file2 file2.k
+%(_python_)s %(cat_py)s file2 file2.k
scons: rebuilding `file3' because:
`yyy' changed
`zzz' changed
-%(cat_py)s file3 xxx yyy zzz
+%(_python_)s %(cat_py)s file3 xxx yyy zzz
scons: rebuilding `%(inc_bbb_k)s' because:
`%(inc_ddd)s' is no longer a dependency
`%(inc_eee)s' is no longer a dependency
`bbb.k' changed
Install file: "bbb.k" as "%(inc_bbb_k)s"
scons: rebuilding `file5' because `%(inc_bbb_k)s' changed
-%(cat_py)s file5 file5.k
+%(_python_)s %(cat_py)s file5 file5.k
scons: rebuilding `file6' because AlwaysBuild() is specified
-%(cat_py)s file6 file6.in
+%(_python_)s %(cat_py)s file6 file6.in
scons: rebuilding `%(subdir_file8)s' because:
`first' is no longer a dependency
`second' is a new dependency
-%(cat_py)s %(subdir_file8)s %(subdir_file7_in)s
+%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -286,7 +287,7 @@ env.Cat('file3', ['xxx', 'yyy'])
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because `zzz' is no longer a dependency
-%(cat_py)s file3 xxx yyy
+%(_python_)s %(cat_py)s file3 xxx yyy
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -302,7 +303,7 @@ env.Cat('file3', ['xxx', 'yyy', 'zzz'])
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because `zzz' is a new dependency
-%(cat_py)s file3 xxx yyy zzz
+%(_python_)s %(cat_py)s file3 xxx yyy zzz
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -316,13 +317,13 @@ Import("env")
env.Cat('file3', ['zzz', 'yyy', 'xxx'])
""")
-cat_py_sep = string.replace(cat_py, '\\', '\\\\')
+python_sep = string.replace(python, '\\', '\\\\')
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because the dependency order changed:
- old: ['xxx', 'yyy', 'zzz', '%(cat_py_sep)s']
- new: ['zzz', 'yyy', 'xxx', '%(cat_py_sep)s']
-%(cat_py)s file3 zzz yyy xxx
+ old: ['xxx', 'yyy', 'zzz', '%(python_sep)s']
+ new: ['zzz', 'yyy', 'xxx', '%(python_sep)s']
+%(_python_)s %(cat_py)s file3 zzz yyy xxx
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -335,19 +336,19 @@ test.write(['src', 'SConscript'], """\
Import("env")
f3 = File('file3')
env.Cat(f3, ['zzz', 'yyy', 'xxx'])
-env.AddPostAction(f3, r'%(cat_py)s ${TARGET}.yyy $SOURCES yyy')
-env.AddPreAction(f3, r'%(cat_py)s ${TARGET}.alt $SOURCES')
+env.AddPostAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy')
+env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES')
""" % locals())
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because the build action changed:
- old: %(cat_py)s $TARGET $SOURCES
- new: %(cat_py)s ${TARGET}.alt $SOURCES
- %(cat_py)s $TARGET $SOURCES
- %(cat_py)s ${TARGET}.yyy $SOURCES yyy
-%(cat_py)s file3.alt zzz yyy xxx
-%(cat_py)s file3 zzz yyy xxx
-%(cat_py)s file3.yyy zzz yyy xxx yyy
+ old: %(_python_)s %(cat_py)s $TARGET $SOURCES
+ new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
+ %(_python_)s %(cat_py)s $TARGET $SOURCES
+ %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy
+%(_python_)s %(cat_py)s file3.alt zzz yyy xxx
+%(_python_)s %(cat_py)s file3 zzz yyy xxx
+%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx yyy
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -362,21 +363,21 @@ test.write(['src', 'SConscript'], """\
Import("env")
f3 = File('file3')
env.Cat(f3, ['zzz', 'yyy', 'xxx'])
-env.AddPostAction(f3, r'%(cat_py)s ${TARGET}.yyy $SOURCES xxx')
-env.AddPreAction(f3, r'%(cat_py)s ${TARGET}.alt $SOURCES')
+env.AddPostAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES xxx')
+env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES')
""" % locals())
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because the build action changed:
- old: %(cat_py)s ${TARGET}.alt $SOURCES
- %(cat_py)s $TARGET $SOURCES
- %(cat_py)s ${TARGET}.yyy $SOURCES yyy
- new: %(cat_py)s ${TARGET}.alt $SOURCES
- %(cat_py)s $TARGET $SOURCES
- %(cat_py)s ${TARGET}.yyy $SOURCES xxx
-%(cat_py)s file3.alt zzz yyy xxx
-%(cat_py)s file3 zzz yyy xxx
-%(cat_py)s file3.yyy zzz yyy xxx xxx
+ old: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
+ %(_python_)s %(cat_py)s $TARGET $SOURCES
+ %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy
+ new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
+ %(_python_)s %(cat_py)s $TARGET $SOURCES
+ %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES xxx
+%(_python_)s %(cat_py)s file3.alt zzz yyy xxx
+%(_python_)s %(cat_py)s file3 zzz yyy xxx
+%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx xxx
""" % locals())
test.run(chdir='src', arguments=args, stdout=expect)
@@ -390,14 +391,14 @@ test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nxxx 1\n")
test.write(['src', 'SConscript'], """\
Import("env")
env.Command('file4', 'file4.in',
- r'%(cat_py)s $TARGET $FILE4FLAG $SOURCES',
+ r'%(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES',
FILE4FLAG='')
""" % locals())
expect = test.wrap_stdout("""\
scons: rebuilding `file4' because the contents of the build action changed
- action: %(cat_py)s $TARGET $FILE4FLAG $SOURCES
-%(cat_py)s file4 file4.in
+ action: %(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES
+%(_python_)s %(cat_py)s file4 file4.in
""" % locals())
test.run(chdir='src',arguments=args, stdout=expect)