OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 '''Interface for all gatherers. | 6 '''Interface for all gatherers. |
7 ''' | 7 ''' |
8 | 8 |
9 | 9 |
10 import os.path | 10 import os.path |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 raise NotImplementedError() | 145 raise NotImplementedError() |
146 | 146 |
147 def SubstituteMessages(self, substituter): | 147 def SubstituteMessages(self, substituter): |
148 '''Applies substitutions to all messages in the gatherer. | 148 '''Applies substitutions to all messages in the gatherer. |
149 | 149 |
150 Args: | 150 Args: |
151 substituter: a grit.util.Substituter object. | 151 substituter: a grit.util.Substituter object. |
152 ''' | 152 ''' |
153 pass | 153 pass |
154 | 154 |
| 155 def SetFilenameExpansionFunction(self, fn): |
| 156 '''Sets a function for rewriting filenames before gathering.''' |
| 157 pass |
| 158 |
155 # TODO(benrg): Move this elsewhere, since it isn't part of the interface. | 159 # TODO(benrg): Move this elsewhere, since it isn't part of the interface. |
156 def _LoadInputFile(self): | 160 def _LoadInputFile(self): |
157 '''A convenience function for subclasses that loads the contents of the | 161 '''A convenience function for subclasses that loads the contents of the |
158 input file. | 162 input file. |
159 ''' | 163 ''' |
160 if isinstance(self.rc_file, types.StringTypes): | 164 if isinstance(self.rc_file, types.StringTypes): |
161 path = self.GetInputPath() | 165 path = self.GetInputPath() |
162 # Hack: some unit tests supply an absolute path and no root node. | 166 # Hack: some unit tests supply an absolute path and no root node. |
163 if not os.path.isabs(path): | 167 if not os.path.isabs(path): |
164 path = self.grd_node.ToRealPath(path) | 168 path = self.grd_node.ToRealPath(path) |
165 return util.ReadFile(path, self.encoding) | 169 return util.ReadFile(path, self.encoding) |
166 else: | 170 else: |
167 return self.rc_file.read() | 171 return self.rc_file.read() |
OLD | NEW |