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

Side by Side Diff: grit/format/rc.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: for landing 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
« no previous file with comments | « no previous file | grit/gather/chrome_scaled_image.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 '''Support for formatting an RC file for compilation. 6 '''Support for formatting an RC file for compilation.
7 ''' 7 '''
8 8
9 import os 9 import os
10 import types 10 import types
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ['admin_template', 'chrome_html', 'chrome_scaled_image', 'igoogle', 425 ['admin_template', 'chrome_html', 'chrome_scaled_image', 'igoogle',
426 'muppet', 'tr_html', 'txt']) 426 'muppet', 'tr_html', 'txt'])
427 filename_only = False 427 filename_only = False
428 relative_path = False 428 relative_path = False
429 429
430 # By default, we use relative pathnames to included resources so that 430 # By default, we use relative pathnames to included resources so that
431 # sharing the resulting .rc files is possible. 431 # sharing the resulting .rc files is possible.
432 # 432 #
433 # The FileForLanguage() Function has the side effect of generating the file 433 # The FileForLanguage() Function has the side effect of generating the file
434 # if needed (e.g. if it is an HTML file include). 434 # if needed (e.g. if it is an HTML file include).
435 filename = os.path.abspath(item.FileForLanguage(lang, output_dir)) 435 file_for_lang = item.FileForLanguage(lang, output_dir)
436 if file_for_lang is None:
437 return ''
438
439 filename = os.path.abspath(file_for_lang)
436 if process_html: 440 if process_html:
437 filename = item.Process(output_dir) 441 filename = item.Process(output_dir)
438 elif filename_only: 442 elif filename_only:
439 filename = os.path.basename(filename) 443 filename = os.path.basename(filename)
440 elif relative_path: 444 elif relative_path:
441 filename = util.MakeRelativePath(output_dir, filename) 445 filename = util.MakeRelativePath(output_dir, filename)
442 446
443 filename = filename.replace('\\', '\\\\') # escape for the RC format 447 filename = filename.replace('\\', '\\\\') # escape for the RC format
444 448
445 if isinstance(item, structure.StructureNode) and item.IsExcludedFromRc(): 449 if isinstance(item, structure.StructureNode) and item.IsExcludedFromRc():
(...skipping 22 matching lines...) Expand all
468 'muppet' : partial(FormatInclude, type='XML'), 472 'muppet' : partial(FormatInclude, type='XML'),
469 'tr_html' : partial(FormatInclude, type='HTML'), 473 'tr_html' : partial(FormatInclude, type='HTML'),
470 'txt' : partial(FormatInclude, type='TXT'), 474 'txt' : partial(FormatInclude, type='TXT'),
471 'policy_template_metafile': _DoNotFormat, 475 'policy_template_metafile': _DoNotFormat,
472 } 476 }
473 477
474 478
475 def FormatStructure(item, lang, output_dir): 479 def FormatStructure(item, lang, output_dir):
476 formatter = _STRUCTURE_FORMATTERS[item.attrs['type']] 480 formatter = _STRUCTURE_FORMATTERS[item.attrs['type']]
477 return formatter(item, lang, output_dir) 481 return formatter(item, lang, output_dir)
OLDNEW
« no previous file with comments | « no previous file | grit/gather/chrome_scaled_image.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698