4 # Permission is hereby granted, free of charge, to any person obtaining
5 # a copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish,
8 # distribute, sublicense, and/or sell copies of the Software, and to
9 # permit persons to whom the Software is furnished to do so, subject to
10 # the following conditions:
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
35 class Environment(collections.UserDict):
36 def Detect(self, cmd):
38 def AppendENVPath(self, key, value):
41 class PlatformTestCase(unittest.TestCase):
42 def test_Platform(self):
43 """Test the Platform() function"""
44 p = SCons.Platform.Platform('cygwin')
45 assert str(p) == 'cygwin', p
48 assert env['PROGSUFFIX'] == '.exe', env
49 assert env['LIBSUFFIX'] == '.a', env
50 assert env['SHELL'] == 'sh', env
52 p = SCons.Platform.Platform('os2')
53 assert str(p) == 'os2', p
56 assert env['PROGSUFFIX'] == '.exe', env
57 assert env['LIBSUFFIX'] == '.lib', env
59 p = SCons.Platform.Platform('posix')
60 assert str(p) == 'posix', p
63 assert env['PROGSUFFIX'] == '', env
64 assert env['LIBSUFFIX'] == '.a', env
65 assert env['SHELL'] == 'sh', env
67 p = SCons.Platform.Platform('irix')
68 assert str(p) == 'irix', p
71 assert env['PROGSUFFIX'] == '', env
72 assert env['LIBSUFFIX'] == '.a', env
73 assert env['SHELL'] == 'sh', env
75 p = SCons.Platform.Platform('aix')
76 assert str(p) == 'aix', p
79 assert env['PROGSUFFIX'] == '', env
80 assert env['LIBSUFFIX'] == '.a', env
81 assert env['SHELL'] == 'sh', env
83 p = SCons.Platform.Platform('sunos')
84 assert str(p) == 'sunos', p
87 assert env['PROGSUFFIX'] == '', env
88 assert env['LIBSUFFIX'] == '.a', env
89 assert env['SHELL'] == 'sh', env
91 p = SCons.Platform.Platform('hpux')
92 assert str(p) == 'hpux', p
95 assert env['PROGSUFFIX'] == '', env
96 assert env['LIBSUFFIX'] == '.a', env
97 assert env['SHELL'] == 'sh', env
99 p = SCons.Platform.Platform('win32')
100 assert str(p) == 'win32', p
103 assert env['PROGSUFFIX'] == '.exe', env
104 assert env['LIBSUFFIX'] == '.lib', env
108 p = SCons.Platform.Platform('_does_not_exist_')
109 except SCons.Errors.UserError:
115 SCons.Platform.Platform()(env)
116 assert env != {}, env
119 if __name__ == "__main__":
120 suite = unittest.makeSuite(PlatformTestCase, 'test_')
121 if not unittest.TextTestRunner().run(suite).wasSuccessful():
126 # indent-tabs-mode:nil
128 # vim: set expandtab tabstop=4 shiftwidth=4: