| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 """Helper script to repack paks for a list of locales. | 6 """Helper script to repack paks for a list of locales. |
| 7 | 7 |
| 8 Gyp doesn't have any built-in looping capability, so this just provides a way to | 8 Gyp doesn't have any built-in looping capability, so this just provides a way to |
| 9 loop over a list of locales when repacking pak files, thus avoiding a | 9 loop over a list of locales when repacking pak files, thus avoiding a |
| 10 proliferation of mostly duplicate, cut-n-paste gyp actions. | 10 proliferation of mostly duplicate, cut-n-paste gyp actions. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class Usage(Exception): | 30 class Usage(Exception): |
| 31 def __init__(self, msg): | 31 def __init__(self, msg): |
| 32 self.msg = msg | 32 self.msg = msg |
| 33 | 33 |
| 34 | 34 |
| 35 def calc_output(locale): | 35 def calc_output(locale): |
| 36 """Determine the file that will be generated for the given locale.""" | 36 """Determine the file that will be generated for the given locale.""" |
| 37 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', | 37 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', |
| 38 if sys.platform in ('darwin',): | 38 if sys.platform in ('darwin',): |
| 39 splitpos = locale.find('-') | 39 return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale) |
| 40 if splitpos == -1: | |
| 41 splitpos = None | |
| 42 return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale[0:splitpos]) | |
| 43 else: | 40 else: |
| 44 return '%s/repack/%s.pak' % (INT_DIR, locale) | 41 return '%s/repack/%s.pak' % (INT_DIR, locale) |
| 45 | 42 |
| 46 | 43 |
| 47 def calc_inputs(locale): | 44 def calc_inputs(locale): |
| 48 """Determine the files that need processing for the given locale.""" | 45 """Determine the files that need processing for the given locale.""" |
| 49 inputs = [] | 46 inputs = [] |
| 50 | 47 |
| 51 #e.g. '<(grit_out_dir)/generated_resources_da.pak' | 48 #e.g. '<(grit_out_dir)/generated_resources_da.pak' |
| 52 inputs.append('%s/generated_resources_%s.pak' % (GRIT_DIR, locale)) | 49 inputs.append('%s/generated_resources_%s.pak' % (GRIT_DIR, locale)) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return 0 | 176 return 0 |
| 180 | 177 |
| 181 if print_outputs: | 178 if print_outputs: |
| 182 list_outputs(locales) | 179 list_outputs(locales) |
| 183 return 0 | 180 return 0 |
| 184 | 181 |
| 185 repack_locales(locales) | 182 repack_locales(locales) |
| 186 | 183 |
| 187 if __name__ == '__main__': | 184 if __name__ == '__main__': |
| 188 sys.exit(main(sys.argv)) | 185 sys.exit(main(sys.argv)) |
| OLD | NEW |