summaryrefslogtreecommitdiff
path: root/test/Precious.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-09-05 19:26:05 +0000
committerSteven Knight <knight@baldmt.com>2003-09-05 19:26:05 +0000
commitbf221d4e593f803116af76ec3bc16514b666c9f1 (patch)
treed80f1ab39365370ce1f50dba335af34f8cad83e2 /test/Precious.py
parentf1d7f1dc87300ea5c905c648c39aeee031100c8c (diff)
downloadscons-bf221d4e593f803116af76ec3bc16514b666c9f1.tar.gz
Support construction variable expansion anywhere in a file or path name.
Diffstat (limited to 'test/Precious.py')
-rw-r--r--test/Precious.py47
1 files changed, 27 insertions, 20 deletions
diff --git a/test/Precious.py b/test/Precious.py
index 8b2c7ff6..6aee9b05 100644
--- a/test/Precious.py
+++ b/test/Precious.py
@@ -24,8 +24,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os
-import sys
+import os.path
+
import TestSCons
python = TestSCons.python
@@ -39,74 +39,81 @@ import sys
sys.exit(0)
""")
-test.write('SConstruct', """
+test.write('SConstruct', """\
B = Builder(action = r"%s build.py $TARGET $SOURCES")
-env = Environment(BUILDERS = { 'B' : B })
+env = Environment(BUILDERS = { 'B' : B }, SUBDIR = 'subdir')
f1 = env.B(target = 'f1.out', source = 'f1.in')
env.B(target = 'f2.out', source = 'f2.in')
env.B(target = 'f3.out', source = 'f3.in')
-env.Precious(f1, 'f2.out')
+env.B(target = 'subdir/f4.out', source = 'f4.in')
+env.Precious(f1, 'f2.out', r'%s')
SConscript('subdir/SConscript', "env")
-""" % python)
+""" % (python,
+ os.path.join('$SUBDIR', 'f4.out')))
test.write(['subdir', 'SConscript'], """
Import("env")
-env.B(target = 'f4.out', source = 'f4.in')
-f5 = env.B(target = 'f5.out', source = 'f5.in')
-env.B(target = 'f6.out', source = 'f6.in')
-env.Precious(['f4.out', f5])
+env.B(target = 'f5.out', source = 'f5.in')
+f6 = env.B(target = 'f6.out', source = 'f6.in')
+env.B(target = 'f7.out', source = 'f7.in')
+env.Precious(['f5.out', f6])
""")
test.write('f1.in', "f1.in\n")
test.write('f2.in', "f2.in\n")
test.write('f3.in', "f3.in\n")
+test.write('f4.in', "f4.in\n")
-test.write(['subdir', 'f4.in'], "subdir/f4.in\n")
test.write(['subdir', 'f5.in'], "subdir/f5.in\n")
test.write(['subdir', 'f6.in'], "subdir/f6.in\n")
+test.write(['subdir', 'f7.in'], "subdir/f7.in\n")
test.write('f1.out', "SHOULD NOT BE REMOVED\n")
test.write('f2.out', "SHOULD NOT BE REMOVED\n")
test.write('f3.out', "SHOULD BE REMOVED\n")
-
test.write(['subdir', 'f4.out'], "SHOULD NOT BE REMOVED\n")
+
test.write(['subdir', 'f5.out'], "SHOULD NOT BE REMOVED\n")
-test.write(['subdir', 'f6.out'], "SHOULD BE REMOVED\n")
+test.write(['subdir', 'f6.out'], "SHOULD NOT BE REMOVED\n")
+test.write(['subdir', 'f7.out'], "SHOULD BE REMOVED\n")
test.run(arguments = '.')
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.fail_test(os.path.exists(test.workpath('f3.out')))
-
test.fail_test(not os.path.exists(test.workpath('subdir', 'f4.out')))
+
test.fail_test(not os.path.exists(test.workpath('subdir', 'f5.out')))
-test.fail_test(os.path.exists(test.workpath('subdir', 'f6.out')))
+test.fail_test(not os.path.exists(test.workpath('subdir', 'f6.out')))
+test.fail_test(os.path.exists(test.workpath('subdir', 'f7.out')))
test.write('f3.out', "SHOULD BE REMOVED\n")
-test.write(['subdir', 'f6.out'], "SHOULD BE REMOVED\n")
+test.write(['subdir', 'f7.out'], "SHOULD BE REMOVED\n")
test.run(arguments = '.')
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.fail_test(not os.path.exists(test.workpath('f3.out')))
-
test.fail_test(not os.path.exists(test.workpath('subdir', 'f4.out')))
+
test.fail_test(not os.path.exists(test.workpath('subdir', 'f5.out')))
test.fail_test(not os.path.exists(test.workpath('subdir', 'f6.out')))
+test.fail_test(not os.path.exists(test.workpath('subdir', 'f7.out')))
test.write('f3.in', "f3.in 2\n")
-test.write(['subdir', 'f6.in'], "subdir/f6.in 2\n")
+test.write(['subdir', 'f7.in'], "subdir/f7.in 2\n")
test.run(arguments = '.')
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.fail_test(os.path.exists(test.workpath('f3.out')))
-
test.fail_test(not os.path.exists(test.workpath('subdir', 'f4.out')))
+
test.fail_test(not os.path.exists(test.workpath('subdir', 'f5.out')))
-test.fail_test(os.path.exists(test.workpath('subdir', 'f6.out')))
+test.fail_test(not os.path.exists(test.workpath('subdir', 'f6.out')))
+test.fail_test(os.path.exists(test.workpath('subdir', 'f7.out')))
test.pass_test()