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 18 matching lines...) Expand all Loading... |
29 'data_package': 'data_pack', | 29 'data_package': 'data_pack', |
30 'js_map_format': 'js_map_format', | 30 'js_map_format': 'js_map_format', |
31 'rc_all': 'rc', | 31 'rc_all': 'rc', |
32 'rc_translateable': 'rc', | 32 'rc_translateable': 'rc', |
33 'rc_nontranslateable': 'rc', | 33 'rc_nontranslateable': 'rc', |
34 'rc_header': 'rc_header', | 34 'rc_header': 'rc_header', |
35 'resource_map_header': 'resource_map', | 35 'resource_map_header': 'resource_map', |
36 'resource_map_source': 'resource_map', | 36 'resource_map_source': 'resource_map', |
37 'resource_file_map_source': 'resource_map', | 37 'resource_file_map_source': 'resource_map', |
38 } | 38 } |
39 _format_modules.update((type, 'policy_templates.template_formatter') | 39 _format_modules.update( |
40 for type in 'adm plist plist_strings admx adml doc json reg'.split()) | 40 (type, 'policy_templates.template_formatter') for type in |
| 41 [ 'adm', 'admx', 'adml', 'reg', 'doc', 'json', |
| 42 'plist', 'plist_strings', 'ios_plist' ]) |
41 | 43 |
42 | 44 |
43 def GetFormatter(type): | 45 def GetFormatter(type): |
44 modulename = 'grit.format.' + _format_modules[type] | 46 modulename = 'grit.format.' + _format_modules[type] |
45 __import__(modulename) | 47 __import__(modulename) |
46 module = sys.modules[modulename] | 48 module = sys.modules[modulename] |
47 try: | 49 try: |
48 return module.Format | 50 return module.Format |
49 except AttributeError: | 51 except AttributeError: |
50 return module.GetFormatter(type) | 52 return module.GetFormatter(type) |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 self.MakeDirectoriesTo(depfile) | 359 self.MakeDirectoriesTo(depfile) |
358 outfile = self.fo_create(depfile, 'wb') | 360 outfile = self.fo_create(depfile, 'wb') |
359 outfile.writelines(depfile_contents) | 361 outfile.writelines(depfile_contents) |
360 | 362 |
361 @staticmethod | 363 @staticmethod |
362 def MakeDirectoriesTo(file): | 364 def MakeDirectoriesTo(file): |
363 '''Creates directories necessary to contain |file|.''' | 365 '''Creates directories necessary to contain |file|.''' |
364 dir = os.path.split(file)[0] | 366 dir = os.path.split(file)[0] |
365 if not os.path.exists(dir): | 367 if not os.path.exists(dir): |
366 os.makedirs(dir) | 368 os.makedirs(dir) |
OLD | NEW |