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

Side by Side Diff: grit_info.py

Issue 1194063002: grit: Add fallback_to_default_layout attribute to <output> (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 5 years, 6 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
« grit/node/io.py ('K') | « grit/tool/build.py ('k') | 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 '''Tool to determine inputs and outputs of a grit file. 6 '''Tool to determine inputs and outputs of a grit file.
7 ''' 7 '''
8 8
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if f.endswith('.py') and not f.endswith('_unittest.py')] 60 if f.endswith('.py') and not f.endswith('_unittest.py')]
61 files.extend(grit_src) 61 files.extend(grit_src)
62 return sorted(files) 62 return sorted(files)
63 63
64 64
65 def Inputs(filename, defines, ids_file, target_platform=None): 65 def Inputs(filename, defines, ids_file, target_platform=None):
66 grd = grd_reader.Parse( 66 grd = grd_reader.Parse(
67 filename, debug=False, defines=defines, tags_to_ignore=set(['message']), 67 filename, debug=False, defines=defines, tags_to_ignore=set(['message']),
68 first_ids_file=ids_file, target_platform=target_platform) 68 first_ids_file=ids_file, target_platform=target_platform)
69 files = set() 69 files = set()
70 for lang, ctx in grd.GetConfigurations(): 70 for lang, ctx, fallback in grd.GetConfigurations():
71 grd.SetOutputLanguage(lang or grd.GetSourceLanguage()) 71 grd.SetOutputLanguage(lang or grd.GetSourceLanguage())
72 grd.SetOutputContext(ctx) 72 grd.SetOutputContext(ctx)
73 grd.SetFallbackToDefaultLayout(fallback)
73 for node in grd.ActiveDescendants(): 74 for node in grd.ActiveDescendants():
74 with node: 75 with node:
75 if (node.name == 'structure' or node.name == 'skeleton' or 76 if (node.name == 'structure' or node.name == 'skeleton' or
76 (node.name == 'file' and node.parent and 77 (node.name == 'file' and node.parent and
77 node.parent.name == 'translations')): 78 node.parent.name == 'translations')):
78 files.add(grd.ToRealPath(node.GetInputPath())) 79 path = node.GetInputPath()
80 if path is not None:
81 files.add(grd.ToRealPath(path))
82
79 # If it's a flattened node, grab inlined resources too. 83 # If it's a flattened node, grab inlined resources too.
80 if node.name == 'structure' and node.attrs['flattenhtml'] == 'true': 84 if node.name == 'structure' and node.attrs['flattenhtml'] == 'true':
81 node.RunPreSubstitutionGatherer() 85 node.RunPreSubstitutionGatherer()
82 files.update(node.GetHtmlResourceFilenames()) 86 files.update(node.GetHtmlResourceFilenames())
83 elif node.name == 'grit': 87 elif node.name == 'grit':
84 first_ids_file = node.GetFirstIdsFile() 88 first_ids_file = node.GetFirstIdsFile()
85 if first_ids_file: 89 if first_ids_file:
86 files.add(first_ids_file) 90 files.add(first_ids_file)
87 elif node.name == 'include': 91 elif node.name == 'include':
88 files.add(grd.ToRealPath(node.GetInputPath())) 92 files.add(grd.ToRealPath(node.GetInputPath()))
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 except WrongNumberOfArguments, e: 182 except WrongNumberOfArguments, e:
179 PrintUsage() 183 PrintUsage()
180 print e 184 print e
181 return 1 185 return 1
182 print result 186 print result
183 return 0 187 return 0
184 188
185 189
186 if __name__ == '__main__': 190 if __name__ == '__main__':
187 sys.exit(main(sys.argv)) 191 sys.exit(main(sys.argv))
OLDNEW
« grit/node/io.py ('K') | « grit/tool/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698