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.
26 Verify that the scons.bat file returns error codes as we expect.
29 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
36 test
= TestSCons
.TestSCons()
38 if sys
.platform
!= 'win32':
39 msg
= "Skipping scons.bat test on non-Windows platform '%s'\n" % sys
.platform
42 python
= test
.where_is('python')
45 msg
= "Skipping scons.bat test; python is not on %PATH%.\n"
48 scons_bat
= os
.path
.splitext(test
.program
)[0] + '.bat'
50 if not os
.path
.exists(scons_bat
):
51 msg
= "Skipping scons.bat test; %s does not exist.\n" % scons_bat
54 test
.write('scons.bat', test
.read(scons_bat
))
56 # The scons.bat file tries to import SCons.Script from its sys.prefix
57 # directories first (i.e., site-packages) which means this test might
58 # end up using an installed SCons in preference to something local.
59 # If so, create a SConstruct file that will exit with our expected
60 # error status. If there is *not* an installed SCons, we still want
61 # this test to work, so we make a "SCons" package in the local
62 # directory with a Script.py module that contains a main() function
63 # that just exits with the expected status.
67 test
.write(['SCons', '__init__.py'], "")
69 test
.write(['SCons', 'Script.py'], """\
75 test
.write('SConstruct', """\
80 test
.run(program
= 'scons.bat', status
= 7)
88 # indent-tabs-mode:nil
90 # vim: set expandtab tabstop=4 shiftwidth=4: