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

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

Issue 1212703002: grit: Ignore empty file paths when generating input file list (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: comments addressed Created 5 years, 5 months 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
« no previous file with comments | « no previous file | grit/node/misc_unittest.py » ('j') | 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 input_files = set() 324 input_files = set()
325 old_output_language = self.output_language 325 old_output_language = self.output_language
326 for lang, ctx, fallback in self.GetConfigurations(): 326 for lang, ctx, fallback in self.GetConfigurations():
327 self.SetOutputLanguage(lang or self.GetSourceLanguage()) 327 self.SetOutputLanguage(lang or self.GetSourceLanguage())
328 self.SetOutputContext(ctx) 328 self.SetOutputContext(ctx)
329 self.SetFallbackToDefaultLayout(fallback) 329 self.SetFallbackToDefaultLayout(fallback)
330 330
331 for node in self.ActiveDescendants(): 331 for node in self.ActiveDescendants():
332 if isinstance(node, (io.FileNode, include.IncludeNode, misc.PartNode, 332 if isinstance(node, (io.FileNode, include.IncludeNode, misc.PartNode,
333 structure.StructureNode, variant.SkeletonNode)): 333 structure.StructureNode, variant.SkeletonNode)):
334 input_files.add(node.GetInputPath()) 334 input_path = node.GetInputPath()
335 if input_path is not None:
336 input_files.add(input_path)
335 self.SetOutputLanguage(old_output_language) 337 self.SetOutputLanguage(old_output_language)
336 return sorted(map(self.ToRealPath, input_files)) 338 return sorted(map(self.ToRealPath, input_files))
337 339
338 def GetFirstIdsFile(self): 340 def GetFirstIdsFile(self):
339 """Returns a usable path to the first_ids file, if set, otherwise 341 """Returns a usable path to the first_ids file, if set, otherwise
340 returns None. 342 returns None.
341 343
342 The first_ids_file attribute is by default relative to the 344 The first_ids_file attribute is by default relative to the
343 base_dir of the .grd file, but may be prefixed by GRIT_DIR/, 345 base_dir of the .grd file, but may be prefixed by GRIT_DIR/,
344 which makes it relative to the directory of grit.py 346 which makes it relative to the directory of grit.py
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 by parameters of the same name. 535 by parameters of the same name.
534 """ 536 """
535 node = IdentifierNode() 537 node = IdentifierNode()
536 node.StartParsing('identifier', parent) 538 node.StartParsing('identifier', parent)
537 node.HandleAttribute('name', name) 539 node.HandleAttribute('name', name)
538 node.HandleAttribute('id', id) 540 node.HandleAttribute('id', id)
539 node.HandleAttribute('comment', comment) 541 node.HandleAttribute('comment', comment)
540 node.HandleAttribute('systemid', systemid) 542 node.HandleAttribute('systemid', systemid)
541 node.EndParsing() 543 node.EndParsing()
542 return node 544 return node
OLDNEW
« no previous file with comments | « no previous file | grit/node/misc_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698