[ci skip] Add note that this change may break SetOption() + ninja usage with fix
[scons.git] / test / EnsureSConsVersion.py
blobefdc17f767aaf6539c728718ac93078a06b38ad1
1 #!/usr/bin/env python
3 # __COPYRIGHT__
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__"
27 import TestSCons
29 test = TestSCons.TestSCons()
31 import SCons
33 if SCons.__version__ != "__VERSION__":
35 test.write('SConstruct', """\
36 env = Environment()
37 env.EnsureSConsVersion(0,0)
38 Exit(0)
39 """)
41 test.run()
43 test.write('SConstruct', """\
44 env = Environment()
45 env.EnsureSConsVersion(1,0)
46 Exit(0)
47 """)
49 test.run()
51 test.write('SConstruct', """\
52 env = Environment()
53 env.EnsureSConsVersion(5,0)
54 Exit(0)
55 """)
57 test.run(status=2)
59 test.write('SConstruct', """\
60 EnsureSConsVersion(2000,0)
61 Exit(0)
62 """)
64 test.run(status=2)
66 test.write('SConstruct', """\
67 env = Environment()
68 env.EnsureSConsVersion(*env.GetSConsVersion())
69 Exit(0)
70 """)
72 test.run()
74 test.write('SConstruct', """\
75 env = Environment()
76 ver = env.GetSConsVersion()
77 env.EnsureSConsVersion(ver[0], ver[1], ver[2])
78 Exit(0)
79 """)
81 test.run()
85 test.write('SConstruct', """\
86 import SCons
87 SCons.__version__ = '0.33.2'
88 EnsureSConsVersion(0,33)
89 """)
91 test.run()
93 test.write('SConstruct', """\
94 import SCons
95 SCons.__version__ = '0.33.2'
96 EnsureSConsVersion(0,33,0)
97 """)
99 test.run()
101 test.write('SConstruct', """\
102 import SCons
103 SCons.__version__ = '0.33.2'
104 EnsureSConsVersion(0,33,1)
105 """)
107 test.run()
109 test.write('SConstruct', """\
110 import SCons
111 SCons.__version__ = '0.33.2'
112 EnsureSConsVersion(0,33,2)
113 """)
115 test.run()
117 test.write('SConstruct', """\
118 import SCons
119 SCons.__version__ = '0.33.2'
120 EnsureSConsVersion(0,33,3)
121 """)
123 test.run(status=2)
125 test.write('SConstruct', """\
126 import SCons
127 SCons.__version__ = '0.33.2'
128 EnsureSConsVersion(0,34)
129 """)
131 test.run(status=2)
133 test.write('SConstruct', """\
134 import SCons
135 SCons.__version__ = '0.33.2'
136 EnsureSConsVersion(1,0)
137 """)
139 test.run(status=2)
141 test.write('SConstruct', """\
142 import SCons
143 EnsureSConsVersion(*GetSConsVersion())
144 """)
146 test.run()
148 test.write('SConstruct', """\
149 import SCons
150 ver = GetSConsVersion()
151 EnsureSConsVersion(ver[0], ver[1], ver[2])
152 """)
154 test.run()
157 test.pass_test()
159 # Local Variables:
160 # tab-width:4
161 # indent-tabs-mode:nil
162 # End:
163 # vim: set expandtab tabstop=4 shiftwidth=4: