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 '''The <structure> element. | 6 '''The <structure> element. |
7 ''' | 7 ''' |
8 | 8 |
9 import os | 9 import os |
10 import platform | 10 import platform |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 if self.attrs['run_command'] and self.RunCommandOnCurrentPlatform(): | 326 if self.attrs['run_command'] and self.RunCommandOnCurrentPlatform(): |
327 # Run arbitrary commands after translation is complete so that it | 327 # Run arbitrary commands after translation is complete so that it |
328 # doesn't interfere with what's in translation console. | 328 # doesn't interfere with what's in translation console. |
329 command = self.attrs['run_command'] % {'filename': filename} | 329 command = self.attrs['run_command'] % {'filename': filename} |
330 result = os.system(command) | 330 result = os.system(command) |
331 assert result == 0, '"%s" failed.' % command | 331 assert result == 0, '"%s" failed.' % command |
332 | 332 |
333 return filename | 333 return filename |
334 | 334 |
| 335 def IsResourceMapSource(self): |
| 336 return True |
| 337 |
| 338 def GeneratesResourceMapEntry(self, output_all_resource_defines, |
| 339 is_active_descendant): |
| 340 if output_all_resource_defines: |
| 341 return True |
| 342 return is_active_descendant |
| 343 |
335 @staticmethod | 344 @staticmethod |
336 def Construct(parent, name, type, file, encoding='cp1252'): | 345 def Construct(parent, name, type, file, encoding='cp1252'): |
337 '''Creates a new node which is a child of 'parent', with attributes set | 346 '''Creates a new node which is a child of 'parent', with attributes set |
338 by parameters of the same name. | 347 by parameters of the same name. |
339 ''' | 348 ''' |
340 node = StructureNode() | 349 node = StructureNode() |
341 node.StartParsing('structure', parent) | 350 node.StartParsing('structure', parent) |
342 node.HandleAttribute('name', name) | 351 node.HandleAttribute('name', name) |
343 node.HandleAttribute('type', type) | 352 node.HandleAttribute('type', type) |
344 node.HandleAttribute('file', file) | 353 node.HandleAttribute('file', file) |
345 node.HandleAttribute('encoding', encoding) | 354 node.HandleAttribute('encoding', encoding) |
346 node.EndParsing() | 355 node.EndParsing() |
347 return node | 356 return node |
348 | 357 |
349 def SubstituteMessages(self, substituter): | 358 def SubstituteMessages(self, substituter): |
350 '''Propagates substitution to gatherer. | 359 '''Propagates substitution to gatherer. |
351 | 360 |
352 Args: | 361 Args: |
353 substituter: a grit.util.Substituter object. | 362 substituter: a grit.util.Substituter object. |
354 ''' | 363 ''' |
355 assert hasattr(self, 'gatherer') | 364 assert hasattr(self, 'gatherer') |
356 if self.ExpandVariables(): | 365 if self.ExpandVariables(): |
357 self.gatherer.SubstituteMessages(substituter) | 366 self.gatherer.SubstituteMessages(substituter) |
358 | 367 |
OLD | NEW |