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

Side by Side Diff: grit/tool/build.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
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 '''The 'grit build' tool along with integration for this tool with the 6 '''The 'grit build' tool along with integration for this tool with the
7 SCons build system. 7 SCons build system.
8 ''' 8 '''
9 9
10 import filecmp 10 import filecmp
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 elif output.GetType() in ('chrome_messages_json'): 333 elif output.GetType() in ('chrome_messages_json'):
334 # Chrome Web Store currently expects BOM for UTF-8 files :-( 334 # Chrome Web Store currently expects BOM for UTF-8 files :-(
335 encoding = 'utf-8-sig' 335 encoding = 'utf-8-sig'
336 else: 336 else:
337 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml 337 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml
338 encoding = 'utf_16' 338 encoding = 'utf_16'
339 339
340 # Set the context, for conditional inclusion of resources 340 # Set the context, for conditional inclusion of resources
341 self.res.SetOutputLanguage(output.GetLanguage()) 341 self.res.SetOutputLanguage(output.GetLanguage())
342 self.res.SetOutputContext(output.GetContext()) 342 self.res.SetOutputContext(output.GetContext())
343 self.res.SetFallbackToDefaultLayout(output.GetFallbackToDefaultLayout())
343 self.res.SetDefines(self.defines) 344 self.res.SetDefines(self.defines)
344 345
345 # Make the output directory if it doesn't exist. 346 # Make the output directory if it doesn't exist.
346 self.MakeDirectoriesTo(output.GetOutputFilename()) 347 self.MakeDirectoriesTo(output.GetOutputFilename())
347 348
348 # Write the results to a temporary file and only overwrite the original 349 # Write the results to a temporary file and only overwrite the original
349 # if the file changed. This avoids unnecessary rebuilds. 350 # if the file changed. This avoids unnecessary rebuilds.
350 outfile = self.fo_create(output.GetOutputFilename() + '.tmp', 'wb') 351 outfile = self.fo_create(output.GetOutputFilename() + '.tmp', 'wb')
351 352
352 if output.GetType() != 'data_package': 353 if output.GetType() != 'data_package':
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 self.MakeDirectoriesTo(depfile) 489 self.MakeDirectoriesTo(depfile)
489 outfile = self.fo_create(depfile, 'wb') 490 outfile = self.fo_create(depfile, 'wb')
490 outfile.writelines(depfile_contents) 491 outfile.writelines(depfile_contents)
491 492
492 @staticmethod 493 @staticmethod
493 def MakeDirectoriesTo(file): 494 def MakeDirectoriesTo(file):
494 '''Creates directories necessary to contain |file|.''' 495 '''Creates directories necessary to contain |file|.'''
495 dir = os.path.split(file)[0] 496 dir = os.path.split(file)[0]
496 if not os.path.exists(dir): 497 if not os.path.exists(dir):
497 os.makedirs(dir) 498 os.makedirs(dir)
OLDNEW
« grit/node/io.py ('K') | « grit/node/misc.py ('k') | grit_info.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698