summaryrefslogtreecommitdiff
path: root/test/ENV.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-09-28 20:27:29 +0000
committerSteven Knight <knight@baldmt.com>2001-09-28 20:27:29 +0000
commit1740dba381b84692daa6b8e01eb4a52bf61330de (patch)
tree51b14217886c985476220eaec6ca3c45601a2167 /test/ENV.py
parentd16a7ced0b53750e4252671c83bc7de871c69a46 (diff)
downloadscons-1740dba381b84692daa6b8e01eb4a52bf61330de.tar.gz
Add support for the ENV construction variable.
Diffstat (limited to 'test/ENV.py')
-rw-r--r--test/ENV.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/ENV.py b/test/ENV.py
new file mode 100644
index 00000000..b3d7efaa
--- /dev/null
+++ b/test/ENV.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('bin1', 'bin2')
+
+bin1 = test.workpath('bin1')
+bin2 = test.workpath('bin2')
+bin1_build_py = test.workpath('bin1', 'build.py')
+bin2_build_py = test.workpath('bin2', 'build.py')
+
+test.write('SConstruct', """
+import os
+bin1_path = r'%s' + os.pathsep + os.environ['PATH']
+bin2_path = r'%s' + os.pathsep + os.environ['PATH']
+Bld = Builder(name = 'Bld', action = "build.py %%(target)s %%(source)s")
+bin1 = Environment(ENV = {'PATH' : bin1_path}, BUILDERS = [Bld])
+bin2 = Environment(ENV = {'PATH' : bin2_path}, BUILDERS = [Bld])
+bin1.Bld(target = 'bin1.out', source = 'input')
+bin2.Bld(target = 'bin2.out', source = 'input')
+""" % (bin1, bin2))
+
+test.write(bin1_build_py,
+"""#!/usr/bin/env python
+import sys
+contents = open(sys.argv[2], 'r').read()
+file = open(sys.argv[1], 'w')
+file.write("bin1/build.py\\n")
+file.write(contents)
+file.close()
+""")
+os.chmod(bin1_build_py, 0755)
+
+test.write(bin2_build_py,
+"""#!/usr/bin/env python
+import sys
+contents = open(sys.argv[2], 'r').read()
+file = open(sys.argv[1], 'w')
+file.write("bin2/build.py\\n")
+file.write(contents)
+file.close()
+""")
+os.chmod(bin2_build_py, 0755)
+
+test.write('input', "input file\n")
+
+#test.run(arguments = '.')
+test.run(arguments = 'bin1.out bin2.out')
+
+test.fail_test(test.read('bin1.out') != "bin1/build.py\ninput file\n")
+test.fail_test(test.read('bin2.out') != "bin2/build.py\ninput file\n")
+
+test.pass_test()