OLD | NEW |
1 """engine.SCons.Variables.ListVariable | 1 """engine.SCons.Variables.ListVariable |
2 | 2 |
3 This file defines the option type for SCons implementing 'lists'. | 3 This file defines the option type for SCons implementing 'lists'. |
4 | 4 |
5 A 'list' option may either be 'all', 'none' or a list of names | 5 A 'list' option may either be 'all', 'none' or a list of names |
6 separated by comma. After the option has been processed, the option | 6 separated by comma. After the option has been processed, the option |
7 value holds either the named list elements, all list elemens or no | 7 value holds either the named list elements, all list elemens or no |
8 list elements at all. | 8 list elements at all. |
9 | 9 |
10 Usage example: | 10 Usage example: |
11 | 11 |
12 list_of_libs = Split('x11 gl qt ical') | 12 list_of_libs = Split('x11 gl qt ical') |
13 | 13 |
14 opts = Variables() | 14 opts = Variables() |
15 opts.Add(ListVariable('shared', | 15 opts.Add(ListVariable('shared', |
16 'libraries to build as shared libraries', | 16 'libraries to build as shared libraries', |
17 'all', | 17 'all', |
18 elems = list_of_libs)) | 18 elems = list_of_libs)) |
19 ... | 19 ... |
20 for lib in list_of_libs: | 20 for lib in list_of_libs: |
21 if lib in env['shared']: | 21 if lib in env['shared']: |
22 env.SharedObject(...) | 22 env.SharedObject(...) |
23 else: | 23 else: |
24 env.Object(...) | 24 env.Object(...) |
25 """ | 25 """ |
26 | 26 |
27 # | 27 # |
28 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 28 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons F
oundation |
29 # | 29 # |
30 # Permission is hereby granted, free of charge, to any person obtaining | 30 # Permission is hereby granted, free of charge, to any person obtaining |
31 # a copy of this software and associated documentation files (the | 31 # a copy of this software and associated documentation files (the |
32 # "Software"), to deal in the Software without restriction, including | 32 # "Software"), to deal in the Software without restriction, including |
33 # without limitation the rights to use, copy, modify, merge, publish, | 33 # without limitation the rights to use, copy, modify, merge, publish, |
34 # distribute, sublicense, and/or sell copies of the Software, and to | 34 # distribute, sublicense, and/or sell copies of the Software, and to |
35 # permit persons to whom the Software is furnished to do so, subject to | 35 # permit persons to whom the Software is furnished to do so, subject to |
36 # the following conditions: | 36 # the following conditions: |
37 # | 37 # |
38 # The above copyright notice and this permission notice shall be included | 38 # The above copyright notice and this permission notice shall be included |
39 # in all copies or substantial portions of the Software. | 39 # in all copies or substantial portions of the Software. |
40 # | 40 # |
41 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 41 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
42 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 42 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
43 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 43 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
44 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 44 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
45 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 45 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
46 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 46 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
47 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 47 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
48 # | 48 # |
49 | 49 |
50 __revision__ = "src/engine/SCons/Variables/ListVariable.py 3842 2008/12/20 22:59
:52 scons" | 50 __revision__ = "src/engine/SCons/Variables/ListVariable.py 3897 2009/01/13 06:45
:54 scons" |
51 | 51 |
52 # Know Bug: This should behave like a Set-Type, but does not really, | 52 # Know Bug: This should behave like a Set-Type, but does not really, |
53 # since elements can occur twice. | 53 # since elements can occur twice. |
54 | 54 |
55 __all__ = ['ListVariable',] | 55 __all__ = ['ListVariable',] |
56 | 56 |
57 import string | 57 import string |
58 import UserList | 58 import UserList |
59 | 59 |
60 import SCons.Util | 60 import SCons.Util |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 """ | 124 """ |
125 names_str = 'allowed names: %s' % string.join(names, ' ') | 125 names_str = 'allowed names: %s' % string.join(names, ' ') |
126 if SCons.Util.is_List(default): | 126 if SCons.Util.is_List(default): |
127 default = string.join(default, ',') | 127 default = string.join(default, ',') |
128 help = string.join( | 128 help = string.join( |
129 (help, '(all|none|comma-separated list of names)', names_str), | 129 (help, '(all|none|comma-separated list of names)', names_str), |
130 '\n ') | 130 '\n ') |
131 return (key, help, default, | 131 return (key, help, default, |
132 None, #_validator, | 132 None, #_validator, |
133 lambda val, elems=names, m=map: _converter(val, elems, m)) | 133 lambda val, elems=names, m=map: _converter(val, elems, m)) |
OLD | NEW |