| OLD | NEW |
| 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 Tool module for adding, to a construction environment, Chromium-specific | 6 Tool module for adding, to a construction environment, Chromium-specific |
| 7 wrappers around SCons builders. This gives us a central place for any | 7 wrappers around SCons builders. This gives us a central place for any |
| 8 customization we need to make to the different things we build. | 8 customization we need to make to the different things we build. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 from SCons.Script import * | 13 from SCons.Script import * |
| 14 | 14 |
| 15 import SCons.Node | 15 import SCons.Node |
| 16 import SCons.Util |
| 16 | 17 |
| 17 class Null(object): | 18 class Null(object): |
| 18 def __new__(cls, *args, **kwargs): | 19 def __new__(cls, *args, **kwargs): |
| 19 if '_inst' not in vars(cls): | 20 if '_inst' not in vars(cls): |
| 20 cls._inst = super(type, cls).__new__(cls, *args, **kwargs) | 21 cls._inst = super(type, cls).__new__(cls, *args, **kwargs) |
| 21 return cls._inst | 22 return cls._inst |
| 22 def __init__(self, *args, **kwargs): pass | 23 def __init__(self, *args, **kwargs): pass |
| 23 def __call__(self, *args, **kwargs): return self | 24 def __call__(self, *args, **kwargs): return self |
| 24 def __repr__(self): return "Null()" | 25 def __repr__(self): return "Null()" |
| 25 def __nonzero__(self): return False | 26 def __nonzero__(self): return False |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 top.remove(element) | 110 top.remove(element) |
| 110 except ValueError: | 111 except ValueError: |
| 111 pass | 112 pass |
| 112 def Replace(self, old, new): | 113 def Replace(self, old, new): |
| 113 for top, lists, nonlists in FileListWalk(self, topdown=False): | 114 for top, lists, nonlists in FileListWalk(self, topdown=False): |
| 114 try: | 115 try: |
| 115 i = top.index(old) | 116 i = top.index(old) |
| 116 except ValueError: | 117 except ValueError: |
| 117 pass | 118 pass |
| 118 else: | 119 else: |
| 119 top[i] = new | 120 if SCons.Util.is_List(new): |
| 121 top[i:i+1] = new |
| 122 else: |
| 123 top[i] = new |
| 120 | 124 |
| 121 | 125 |
| 122 def FilterOut(self, **kw): | 126 def FilterOut(self, **kw): |
| 123 """Removes values from existing construction variables in an Environment. | 127 """Removes values from existing construction variables in an Environment. |
| 124 | 128 |
| 125 The values to remove should be a list. For example: | 129 The values to remove should be a list. For example: |
| 126 | 130 |
| 127 self.FilterOut(CPPDEFINES=['REMOVE_ME', 'ME_TOO']) | 131 self.FilterOut(CPPDEFINES=['REMOVE_ME', 'ME_TOO']) |
| 128 | 132 |
| 129 Args: | 133 Args: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 151 | 155 |
| 152 | 156 |
| 153 import __builtin__ | 157 import __builtin__ |
| 154 __builtin__.ChromeFileList = ChromeFileList | 158 __builtin__.ChromeFileList = ChromeFileList |
| 155 | 159 |
| 156 non_compilable_suffixes = { | 160 non_compilable_suffixes = { |
| 157 'LINUX' : set([ | 161 'LINUX' : set([ |
| 158 '.bdic', | 162 '.bdic', |
| 159 '.css', | 163 '.css', |
| 160 '.dat', | 164 '.dat', |
| 165 '.gperf', |
| 161 '.h', | 166 '.h', |
| 162 '.html', | 167 '.html', |
| 163 '.hxx', | 168 '.hxx', |
| 164 '.idl', | 169 '.idl', |
| 165 '.js', | 170 '.js', |
| 166 '.rc', | 171 '.rc', |
| 167 ]), | 172 ]), |
| 168 'WINDOWS' : set([ | 173 'WINDOWS' : set([ |
| 169 '.h', | 174 '.h', |
| 170 '.dat', | 175 '.dat', |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 # Add the grit tool to the base environment because we use this a lot. | 260 # Add the grit tool to the base environment because we use this a lot. |
| 256 sys.path.append(env.Dir('$SRC_DIR/tools/grit').abspath) | 261 sys.path.append(env.Dir('$SRC_DIR/tools/grit').abspath) |
| 257 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/grit/grit')]) | 262 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/grit/grit')]) |
| 258 | 263 |
| 259 # Add the repack python script tool that we use in multiple places. | 264 # Add the repack python script tool that we use in multiple places. |
| 260 sys.path.append(env.Dir('$SRC_DIR/tools/data_pack').abspath) | 265 sys.path.append(env.Dir('$SRC_DIR/tools/data_pack').abspath) |
| 261 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/data_pack/')]) | 266 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/data_pack/')]) |
| 262 | 267 |
| 263 def exists(env): | 268 def exists(env): |
| 264 return True | 269 return True |
| OLD | NEW |