summaryrefslogtreecommitdiffstats
path: root/test/ParseConfig.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-11-12 13:43:54 (GMT)
committerSteven Knight <knight@baldmt.com>2002-11-12 13:43:54 (GMT)
commit889f0c7238da15a89be500e40ce9f73102e31b8c (patch)
tree92ed84c42045815814f2cb39fc39e7c5984c5bb7 /test/ParseConfig.py
parent1cfff0b089cc56024ed5ea71c33ad843373bb9fc (diff)
downloadSCons-889f0c7238da15a89be500e40ce9f73102e31b8c.zip
SCons-889f0c7238da15a89be500e40ce9f73102e31b8c.tar.gz
SCons-889f0c7238da15a89be500e40ce9f73102e31b8c.tar.bz2
Add the ParseConfig() method. (Steve Leblanc)
Diffstat (limited to 'test/ParseConfig.py')
-rw-r--r--test/ParseConfig.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/ParseConfig.py b/test/ParseConfig.py
new file mode 100644
index 0000000..1cf52ed
--- /dev/null
+++ b/test/ParseConfig.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test_config = test.workpath('test-config')
+
+test.write('test-config', """#! /usr/bin/env python
+print "-I/usr/include/fum -Ibar -X"
+print "-L/usr/fax -Lfoo -lxxx abc"
+""")
+
+test.write('SConstruct', """
+env = Environment()
+static_libs = ParseConfig(env, ["%s", "%s", "--libs --cflags"])
+print env['CPPPATH']
+print env['LIBPATH']
+print env['LIBS']
+print env['CCFLAGS']
+print static_libs
+""" % (sys.executable, test_config))
+
+test.write('SConstruct2', """
+env = Environment()
+static_libs = ParseConfig(env, "%s %s --libs --cflags")
+print env['CPPPATH']
+print env['LIBPATH']
+print env['LIBS']
+print env['CCFLAGS']
+print static_libs
+""" % (sys.executable, test_config))
+
+good_stdout = test.wrap_stdout(read_str = """\
+['/usr/include/fum', 'bar']
+['/usr/fax', 'foo']
+['xxx']
+['-X']
+['abc']
+""", build_str = 'scons: "." is up to date.\n')
+
+test.run(arguments = ".", stdout = good_stdout)
+
+test.run(arguments = "-f SConstruct2 .", stdout = good_stdout)
+
+test.pass_test()