OLD | NEW |
1 """SCons.Platform | 1 """SCons.Platform |
2 | 2 |
3 SCons platform selection. | 3 SCons platform selection. |
4 | 4 |
5 This looks for modules that define a callable object that can modify a | 5 This looks for modules that define a callable object that can modify a |
6 construction environment as appropriate for a given platform. | 6 construction environment as appropriate for a given platform. |
7 | 7 |
8 Note that we take a more simplistic view of "platform" than Python does. | 8 Note that we take a more simplistic view of "platform" than Python does. |
9 We're looking for a single string that determines a set of | 9 We're looking for a single string that determines a set of |
10 tool-independent variables with which to initialize a construction | 10 tool-independent variables with which to initialize a construction |
11 environment. Consequently, we'll examine both sys.platform and os.name | 11 environment. Consequently, we'll examine both sys.platform and os.name |
12 (and anything else that might come in to play) in order to return some | 12 (and anything else that might come in to play) in order to return some |
13 specification which is unique enough for our purposes. | 13 specification which is unique enough for our purposes. |
14 | 14 |
15 Note that because this subsysem just *selects* a callable that can | 15 Note that because this subsysem just *selects* a callable that can |
16 modify a construction environment, it's possible for people to define | 16 modify a construction environment, it's possible for people to define |
17 their own "platform specification" in an arbitrary callable function. | 17 their own "platform specification" in an arbitrary callable function. |
18 No one needs to use or tie in to this subsystem in order to roll | 18 No one needs to use or tie in to this subsystem in order to roll |
19 their own platform definition. | 19 their own platform definition. |
20 """ | 20 """ |
21 | 21 |
22 # | 22 # |
23 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 23 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons F
oundation |
24 # | 24 # |
25 # Permission is hereby granted, free of charge, to any person obtaining | 25 # Permission is hereby granted, free of charge, to any person obtaining |
26 # a copy of this software and associated documentation files (the | 26 # a copy of this software and associated documentation files (the |
27 # "Software"), to deal in the Software without restriction, including | 27 # "Software"), to deal in the Software without restriction, including |
28 # without limitation the rights to use, copy, modify, merge, publish, | 28 # without limitation the rights to use, copy, modify, merge, publish, |
29 # distribute, sublicense, and/or sell copies of the Software, and to | 29 # distribute, sublicense, and/or sell copies of the Software, and to |
30 # permit persons to whom the Software is furnished to do so, subject to | 30 # permit persons to whom the Software is furnished to do so, subject to |
31 # the following conditions: | 31 # the following conditions: |
32 # | 32 # |
33 # The above copyright notice and this permission notice shall be included | 33 # The above copyright notice and this permission notice shall be included |
34 # in all copies or substantial portions of the Software. | 34 # in all copies or substantial portions of the Software. |
35 # | 35 # |
36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
37 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 37 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
38 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 38 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
39 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 39 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
40 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 40 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
41 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 41 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
42 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 42 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
43 # | 43 # |
44 | 44 |
45 __revision__ = "src/engine/SCons/Platform/__init__.py 3842 2008/12/20 22:59:52 s
cons" | 45 __revision__ = "src/engine/SCons/Platform/__init__.py 3897 2009/01/13 06:45:54 s
cons" |
46 | 46 |
47 import imp | 47 import imp |
48 import os | 48 import os |
49 import string | 49 import string |
50 import sys | 50 import sys |
51 import tempfile | 51 import tempfile |
52 | 52 |
53 import SCons.Errors | 53 import SCons.Errors |
54 import SCons.Tool | 54 import SCons.Tool |
55 | 55 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 str(cmd[0]) + " " + string.join(args," ")) | 207 str(cmd[0]) + " " + string.join(args," ")) |
208 return [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ] | 208 return [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ] |
209 | 209 |
210 def Platform(name = platform_default()): | 210 def Platform(name = platform_default()): |
211 """Select a canned Platform specification. | 211 """Select a canned Platform specification. |
212 """ | 212 """ |
213 module = platform_module(name) | 213 module = platform_module(name) |
214 spec = PlatformSpec(name) | 214 spec = PlatformSpec(name) |
215 spec.__call__ = module.generate | 215 spec.__call__ = module.generate |
216 return spec | 216 return spec |
OLD | NEW |