| OLD | NEW |
| 1 """SCons.Util | 1 """SCons.Util |
| 2 | 2 |
| 3 Various utility functions go here. | 3 Various utility functions go here. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 | 6 |
| 7 # | 7 # |
| 8 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 8 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion |
| 9 # | 9 # |
| 10 # Permission is hereby granted, free of charge, to any person obtaining | 10 # Permission is hereby granted, free of charge, to any person obtaining |
| 11 # a copy of this software and associated documentation files (the | 11 # a copy of this software and associated documentation files (the |
| 12 # "Software"), to deal in the Software without restriction, including | 12 # "Software"), to deal in the Software without restriction, including |
| 13 # without limitation the rights to use, copy, modify, merge, publish, | 13 # without limitation the rights to use, copy, modify, merge, publish, |
| 14 # distribute, sublicense, and/or sell copies of the Software, and to | 14 # distribute, sublicense, and/or sell copies of the Software, and to |
| 15 # permit persons to whom the Software is furnished to do so, subject to | 15 # permit persons to whom the Software is furnished to do so, subject to |
| 16 # the following conditions: | 16 # the following conditions: |
| 17 # | 17 # |
| 18 # The above copyright notice and this permission notice shall be included | 18 # The above copyright notice and this permission notice shall be included |
| 19 # in all copies or substantial portions of the Software. | 19 # in all copies or substantial portions of the Software. |
| 20 # | 20 # |
| 21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
| 22 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 22 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 23 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 23 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 24 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 24 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 25 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 25 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 26 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 26 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 27 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 27 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 28 # | 28 # |
| 29 | 29 |
| 30 __revision__ = "src/engine/SCons/Util.py 3603 2008/10/10 05:46:45 scons" | 30 __revision__ = "src/engine/SCons/Util.py 3842 2008/12/20 22:59:52 scons" |
| 31 | 31 |
| 32 import copy | 32 import copy |
| 33 import os | 33 import os |
| 34 import os.path | 34 import os.path |
| 35 import re | 35 import re |
| 36 import string | 36 import string |
| 37 import sys | 37 import sys |
| 38 import types | 38 import types |
| 39 | 39 |
| 40 from UserDict import UserDict | 40 from UserDict import UserDict |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 | 1015 |
| 1016 This is a list that uses Split() to split an initial string along | 1016 This is a list that uses Split() to split an initial string along |
| 1017 white-space arguments, and similarly to split any strings that get | 1017 white-space arguments, and similarly to split any strings that get |
| 1018 added. This allows us to Do the Right Thing with Append() and | 1018 added. This allows us to Do the Right Thing with Append() and |
| 1019 Prepend() (as well as straight Python foo = env['VAR'] + 'arg1 | 1019 Prepend() (as well as straight Python foo = env['VAR'] + 'arg1 |
| 1020 arg2') regardless of whether a user adds a list or a string to a | 1020 arg2') regardless of whether a user adds a list or a string to a |
| 1021 command-line construction variable. | 1021 command-line construction variable. |
| 1022 """ | 1022 """ |
| 1023 def __init__(self, seq = []): | 1023 def __init__(self, seq = []): |
| 1024 UserList.__init__(self, Split(seq)) | 1024 UserList.__init__(self, Split(seq)) |
| 1025 def __add__(self, other): |
| 1026 return UserList.__add__(self, CLVar(other)) |
| 1027 def __radd__(self, other): |
| 1028 return UserList.__radd__(self, CLVar(other)) |
| 1025 def __coerce__(self, other): | 1029 def __coerce__(self, other): |
| 1026 return (self, CLVar(other)) | 1030 return (self, CLVar(other)) |
| 1027 def __str__(self): | 1031 def __str__(self): |
| 1028 return string.join(self.data) | 1032 return string.join(self.data) |
| 1029 | 1033 |
| 1030 # A dictionary that preserves the order in which items are added. | 1034 # A dictionary that preserves the order in which items are added. |
| 1031 # Submitted by David Benjamin to ActiveState's Python Cookbook web site: | 1035 # Submitted by David Benjamin to ActiveState's Python Cookbook web site: |
| 1032 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 | 1036 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 |
| 1033 # Including fixes/enhancements from the follow-on discussions. | 1037 # Including fixes/enhancements from the follow-on discussions. |
| 1034 class OrderedDict(UserDict): | 1038 class OrderedDict(UserDict): |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 def __getattr__(self, mname): | 1568 def __getattr__(self, mname): |
| 1565 return self | 1569 return self |
| 1566 def __setattr__(self, name, value): | 1570 def __setattr__(self, name, value): |
| 1567 return self | 1571 return self |
| 1568 def __delattr__(self, name): | 1572 def __delattr__(self, name): |
| 1569 return self | 1573 return self |
| 1570 | 1574 |
| 1571 | 1575 |
| 1572 | 1576 |
| 1573 del __revision__ | 1577 del __revision__ |
| OLD | NEW |