| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 for iOS. | 6 """Helper script to repack paks for a list of locales for iOS. |
| 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. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import optparse | 13 import optparse |
| 14 import os | 14 import os |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 # Prepend the grit module from the source tree so it takes precedence over other |
| 18 # grit versions that might present in the search path. |
| 17 script_dir = os.path.dirname(__file__) | 19 script_dir = os.path.dirname(__file__) |
| 18 src_dir = os.path.join(script_dir, os.pardir, os.pardir, os.pardir, os.pardir) | 20 src_dir = os.path.join(script_dir, os.pardir, os.pardir, os.pardir, os.pardir) |
| 19 sys.path.append(os.path.join(src_dir, 'tools', 'grit')) | 21 sys.path.insert(1, os.path.join(src_dir, 'tools', 'grit')) |
| 20 | 22 |
| 21 from grit.format import data_pack | 23 from grit.format import data_pack |
| 22 | 24 |
| 23 | 25 |
| 24 def calc_output(options, locale): | 26 def calc_output(options, locale): |
| 25 """Determine the file that will be generated for the given locale.""" | 27 """Determine the file that will be generated for the given locale.""" |
| 26 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', | 28 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', |
| 27 # For Fake Bidi, generate it at a fixed path so that tests can safely | 29 # For Fake Bidi, generate it at a fixed path so that tests can safely |
| 28 # reference it. | 30 # reference it. |
| 29 if locale == 'fake-bidi': | 31 if locale == 'fake-bidi': |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 162 |
| 161 if options.print_outputs: | 163 if options.print_outputs: |
| 162 return quote_filenames(list_outputs(options, locales)) | 164 return quote_filenames(list_outputs(options, locales)) |
| 163 | 165 |
| 164 return repack_locales(options, locales) | 166 return repack_locales(options, locales) |
| 165 | 167 |
| 166 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 167 results = DoMain(sys.argv[1:]) | 169 results = DoMain(sys.argv[1:]) |
| 168 if results: | 170 if results: |
| 169 print results | 171 print results |
| OLD | NEW |