Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: grit/node/misc.py

Issue 11312072: Fix grit to substitute GRIT_DIR properly on Windows. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698