| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 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 rename paks for a list of locales for the Android WebView. | 6 """Helper script to rename paks for a list of locales for the Android WebView. |
| 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 renaming pak files. Based on | 9 loop over a list of locales when renaming pak files. Based on |
| 10 chrome/tools/build/repack_locales.py | 10 chrome/tools/build/repack_locales.py |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import optparse | 13 import optparse |
| 14 import os | 14 import os |
| 15 import shutil | 15 import shutil |
| 16 import sys | 16 import sys |
| 17 | 17 |
| 18 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', | 18 # Prepend the grit module from the source tree so it takes precedence over other |
| 19 'tools', 'grit')) | 19 # grit versions that might present in the search path. |
| 20 sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..', '..', |
| 21 'tools', 'grit')) |
| 20 from grit.format import data_pack | 22 from grit.format import data_pack |
| 21 | 23 |
| 22 def calc_output(locale): | 24 def calc_output(locale): |
| 23 """Determine the file that will be generated for the given locale.""" | 25 """Determine the file that will be generated for the given locale.""" |
| 24 return os.path.join(PRODUCT_DIR, 'android_webview_assets', | 26 return os.path.join(PRODUCT_DIR, 'android_webview_assets', |
| 25 'locales', locale + '.pak') | 27 'locales', locale + '.pak') |
| 26 | 28 |
| 27 def calc_inputs(locale): | 29 def calc_inputs(locale): |
| 28 """Determine the files that need processing for the given locale.""" | 30 """Determine the files that need processing for the given locale.""" |
| 29 inputs = [] | 31 inputs = [] |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 102 |
| 101 if print_outputs: | 103 if print_outputs: |
| 102 return list_outputs(locales) | 104 return list_outputs(locales) |
| 103 | 105 |
| 104 return repack_locales(locales) | 106 return repack_locales(locales) |
| 105 | 107 |
| 106 if __name__ == '__main__': | 108 if __name__ == '__main__': |
| 107 results = DoMain(sys.argv[1:]) | 109 results = DoMain(sys.argv[1:]) |
| 108 if results: | 110 if results: |
| 109 print results | 111 print results |
| OLD | NEW |