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:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
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.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Verify that we can import and use the contents of Platform and Tool
36 # must do this here, since TestSCons will chdir
37 tooldir = os.path.join(os.getcwd(), 'src', 'engine', 'SCons', 'Tool')
40 test = TestSCons.TestSCons()
42 # Before executing the any of the platform or tool modules, add some
43 # null entries to the environment $PATH variable to make sure there's
44 # no code that tries to index elements from the list before making sure
46 # (This was a problem in checkpoint release 0.97.d020070809.)
47 os.environ['PATH'] = os.pathsep + os.environ['PATH'] + \
48 os.pathsep + os.pathsep + '/no/such/dir' + os.pathsep
50 SConstruct_path = test.workpath('SConstruct')
64 for platform in platforms:
65 test.write('SConstruct', """
66 print "Platform %(platform)s"
67 env = Environment(platform = '%(platform)s')
68 import SCons.Platform.%(platform)s
69 x = SCons.Platform.%(platform)s.generate
73 ignore = ('__init__.py',
74 # Can't import these everywhere due to Windows registry dependency.
75 '386asm.py', 'linkloc.py',
76 # Directory of common stuff for MSVC and MSVS
78 # Sun pkgchk and pkginfo common stuff
82 for name in os.listdir(tooldir):
83 if name in ignore: continue
84 if name[-3:] == '.py':
85 if name[-8:] not in ('Tests.py', 'ommon.py'):
86 tools.append(name[:-3])
87 elif os.path.exists(os.path.join(tooldir,name,'__init__.py')):
89 tools.sort() # why not?
91 #if sys.platform == 'win32':
92 # Just comment out (for now?) due to registry dependency.
98 # Intel no compiler warning..
99 intel_no_compiler_warning = """
100 scons: warning: Failed to find Intel compiler for version='None', abi='[^']*'
101 """ + TestSCons.file_expr
103 # Intel no top dir warning.
104 intel_no_top_dir_warning = """
105 scons: warning: Can't find Intel compiler top dir for version='None', abi='[^']*'
106 """ + TestSCons.file_expr
108 # Intel no license directory warning
109 intel_license_warning = re.escape("""
110 scons: warning: Intel license dir was not found. Tried using the INTEL_LICENSE_FILE environment variable (), the registry () and the default path (C:\Program Files\Common Files\Intel\Licenses). Using the default path as a last resort.
111 """) + TestSCons.file_expr
114 re.compile(intel_license_warning),
115 re.compile(intel_no_compiler_warning),
116 re.compile(intel_no_compiler_warning + intel_license_warning),
117 re.compile(intel_no_top_dir_warning),
118 re.compile(intel_no_top_dir_warning + intel_license_warning),
121 moc = test.where_is('moc')
125 qtdir = os.path.dirname(os.path.dirname(moc))
128 scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%(qtdir)s\)
134 scons: warning: Could not detect qt, using empty QTDIR
137 qt_warnings = [ re.compile(qt_err + TestSCons.file_expr) ]
140 'icl' : intel_warnings,
141 'intelc' : intel_warnings,
145 # An SConstruct for importing Tool names that have illegal characters
146 # for Python variable names.
147 indirect_import = """\
148 print "Tool %(tool)s (indirect)"
149 env = Environment(tools = ['%(tool)s'])
151 SCons = __import__('SCons.Tool.%(tool)s', globals(), locals(), [])
152 m = getattr(SCons.Tool, '%(tool)s')
157 # An SConstruct for importing Tool names "normally."
159 print "Tool %(tool)s (direct)"
160 env = Environment(tools = ['%(tool)s'])
162 import SCons.Tool.%(tool)s
164 SCons.Tool.%(tool)s.exists(env)
165 SCons.Tool.%(tool)s.generate(env)
170 if tool[0] in '0123456789' or '+' in tool or tool in ('as',):
171 test.write('SConstruct', indirect_import % locals())
173 test.write('SConstruct', direct_import % locals())
174 test.run(stderr=None)
175 stderr = test.stderr()
178 for expression in error_output.get(tool, []):
179 if expression.match(stderr):
183 print "Failed importing '%s', stderr:" % tool
185 failures.append(tool)
187 test.fail_test(len(failures))
193 # indent-tabs-mode:nil
195 # vim: set expandtab tabstop=4 shiftwidth=4: