| OLD | NEW |
| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 for output in self.res.GetOutputFiles(): | 231 for output in self.res.GetOutputFiles(): |
| 232 self.VerboseOut('Creating %s...' % output.GetFilename()) | 232 self.VerboseOut('Creating %s...' % output.GetFilename()) |
| 233 | 233 |
| 234 # Microsoft's RC compiler can only deal with single-byte or double-byte | 234 # Microsoft's RC compiler can only deal with single-byte or double-byte |
| 235 # files (no UTF-8), so we make all RC files UTF-16 to support all | 235 # files (no UTF-8), so we make all RC files UTF-16 to support all |
| 236 # character sets. | 236 # character sets. |
| 237 if output.GetType() in ('rc_header', 'resource_map_header', | 237 if output.GetType() in ('rc_header', 'resource_map_header', |
| 238 'resource_map_source', 'resource_file_map_source'): | 238 'resource_map_source', 'resource_file_map_source'): |
| 239 encoding = 'cp1252' | 239 encoding = 'cp1252' |
| 240 elif output.GetType() in ('js_map_format', 'plist', 'plist_strings', | 240 elif output.GetType() in ('c_format', 'js_map_format', 'plist', |
| 241 'doc', 'json'): | 241 'plist_strings', 'doc', 'json'): |
| 242 encoding = 'utf_8' | 242 encoding = 'utf_8' |
| 243 else: | 243 else: |
| 244 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml | 244 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml |
| 245 encoding = 'utf_16' | 245 encoding = 'utf_16' |
| 246 | 246 |
| 247 # Make the output directory if it doesn't exist. | 247 # Make the output directory if it doesn't exist. |
| 248 outdir = os.path.split(output.GetOutputFilename())[0] | 248 outdir = os.path.split(output.GetOutputFilename())[0] |
| 249 if not os.path.exists(outdir): | 249 if not os.path.exists(outdir): |
| 250 os.makedirs(outdir) | 250 os.makedirs(outdir) |
| 251 # Write the results to a temporary file and only overwrite the original | 251 # Write the results to a temporary file and only overwrite the original |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 # Print out any fallback warnings, and missing translation errors, and | 297 # Print out any fallback warnings, and missing translation errors, and |
| 298 # exit with an error code if there are missing translations in a non-pseudo | 298 # exit with an error code if there are missing translations in a non-pseudo |
| 299 # and non-official build. | 299 # and non-official build. |
| 300 warnings = (self.res.UberClique().MissingTranslationsReport(). | 300 warnings = (self.res.UberClique().MissingTranslationsReport(). |
| 301 encode('ascii', 'replace')) | 301 encode('ascii', 'replace')) |
| 302 if warnings and self.defines.get('_google_chrome', False): | 302 if warnings and self.defines.get('_google_chrome', False): |
| 303 print warnings | 303 print warnings |
| 304 if self.res.UberClique().HasMissingTranslations(): | 304 if self.res.UberClique().HasMissingTranslations(): |
| 305 sys.exit(-1) | 305 sys.exit(-1) |
| OLD | NEW |