Add a QT tool. (Christoph Wiedemann)
[scons.git] / test / import.py
1 #!/usr/bin/env python
2 #
3 # __COPYRIGHT__
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #
24
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26
27 """
28 Verify that we can import and use the contents of Platform and Tool
29 modules directly.
30 """
31
32 import TestSCons
33
34 test = TestSCons.TestSCons()
35
36 platforms = ['cygwin', 'irix', 'os2', 'posix', 'win32']
37
38 for platform in platforms:
39     test.write('SConstruct', """
40 env = Environment(platform = '%s')
41 import SCons.Platform.%s
42 x = SCons.Platform.%s.generate
43 """ % (platform, platform, platform))
44     test.run()
45
46 tools = [
47     # Can't import '386asm' directly due to initial '3' syntax error...
48     'aixcc',
49     'aixf77',
50     'aixlink',
51     'ar',
52     'as',
53     'BitKeeper',
54     'cc',
55     'CVS',
56     'default',
57     'dvipdf',
58     'dvips',
59     'f77',
60     # Can't import 'g++' directly due to '+' syntax error...
61     'g77',
62     'gas',
63     'gcc',
64     'gnulink',
65     'gs',
66     'hpcc',
67     'hplink',
68     'icc',
69     'icl',
70     'ifl',
71     'ilink',
72     'jar',
73     'javac',
74     'javah',
75     'latex',
76     'lex',
77     'link',
78     # Can't import 'linkloc' everywhere due to Windows registry dependency...
79     'm4',
80     'masm',
81     'midl',
82     'mingw',
83     'mslib',
84     'mslink',
85     'msvc',
86     'msvs',
87     'nasm',
88     'pdflatex',
89     'pdftex',
90     'Perforce',
91     'RCS',
92     'qt',
93     'rmic',
94     'SCCS',
95     'sgiar',
96     'sgicc',
97     'sgilink',
98     'sunar',
99     'suncc',
100     'sunlink',
101     'Subversion',
102     'tar',
103     'tex',
104     'yacc',
105     'zip',
106 ]
107
108 for tool in tools:
109     test.write('SConstruct', """
110 env = Environment(tools = ['%s'])
111 import SCons.Tool.%s
112 x = SCons.Tool.%s.generate
113 """ % (tool, tool, tool))
114     test.run()
115
116 test.pass_test()