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 """Miscellaneous node types. | 6 """Miscellaneous node types. |
7 """ | 7 """ |
8 | 8 |
9 import os.path | 9 import os.path |
10 import re | 10 import re |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 The first_ids_file attribute is by default relative to the | 322 The first_ids_file attribute is by default relative to the |
323 base_dir of the .grd file, but may be prefixed by GRIT_DIR/, | 323 base_dir of the .grd file, but may be prefixed by GRIT_DIR/, |
324 which makes it relative to the directory of grit.py | 324 which makes it relative to the directory of grit.py |
325 (e.g. GRIT_DIR/../gritsettings/resource_ids). | 325 (e.g. GRIT_DIR/../gritsettings/resource_ids). |
326 """ | 326 """ |
327 if not self.attrs['first_ids_file']: | 327 if not self.attrs['first_ids_file']: |
328 return None | 328 return None |
329 | 329 |
330 path = self.attrs['first_ids_file'] | 330 path = self.attrs['first_ids_file'] |
331 GRIT_DIR_PREFIX = 'GRIT_DIR/' | 331 GRIT_DIR_PREFIX = 'GRIT_DIR' |
332 if path.startswith(GRIT_DIR_PREFIX): | 332 if (path.startswith(GRIT_DIR_PREFIX) |
333 return util.PathFromRoot(path[len(GRIT_DIR_PREFIX):]) | 333 and path[len(GRIT_DIR_PREFIX)] in ['/', '\\']): |
| 334 return util.PathFromRoot(path[len(GRIT_DIR_PREFIX) + 1:]) |
334 else: | 335 else: |
335 return self.ToRealPath(path) | 336 return self.ToRealPath(path) |
336 | 337 |
337 def GetOutputFiles(self): | 338 def GetOutputFiles(self): |
338 """Returns the list of <output> nodes that are descendants of this node's | 339 """Returns the list of <output> nodes that are descendants of this node's |
339 <outputs> child and are not enclosed by unsatisfied <if> conditionals. | 340 <outputs> child and are not enclosed by unsatisfied <if> conditionals. |
340 """ | 341 """ |
341 for child in self.children: | 342 for child in self.children: |
342 if child.name == 'outputs': | 343 if child.name == 'outputs': |
343 return [node for node in child.ActiveDescendants() | 344 return [node for node in child.ActiveDescendants() |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 by parameters of the same name. | 505 by parameters of the same name. |
505 """ | 506 """ |
506 node = IdentifierNode() | 507 node = IdentifierNode() |
507 node.StartParsing('identifier', parent) | 508 node.StartParsing('identifier', parent) |
508 node.HandleAttribute('name', name) | 509 node.HandleAttribute('name', name) |
509 node.HandleAttribute('id', id) | 510 node.HandleAttribute('id', id) |
510 node.HandleAttribute('comment', comment) | 511 node.HandleAttribute('comment', comment) |
511 node.HandleAttribute('systemid', systemid) | 512 node.HandleAttribute('systemid', systemid) |
512 node.EndParsing() | 513 node.EndParsing() |
513 return node | 514 return node |
OLD | NEW |