OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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. |
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 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', | 17 # Prepend the grit module from the source tree so it takes precedence over other |
18 'tools', 'grit')) | 18 # grit versions that might present in the search path. |
| 19 sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..', '..', '..', |
| 20 'tools', 'grit')) |
19 from grit.format import data_pack | 21 from grit.format import data_pack |
20 | 22 |
21 # Some build paths defined by gyp. | 23 # Some build paths defined by gyp. |
22 GRIT_DIR = None | 24 GRIT_DIR = None |
23 INT_DIR = None | 25 INT_DIR = None |
24 CHROMECAST_BRANDING = None | 26 CHROMECAST_BRANDING = None |
25 | 27 |
26 class Usage(Exception): | 28 class Usage(Exception): |
27 def __init__(self, msg): | 29 def __init__(self, msg): |
28 self.msg = msg | 30 self.msg = msg |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 129 |
128 if print_outputs: | 130 if print_outputs: |
129 return list_outputs(locales) | 131 return list_outputs(locales) |
130 | 132 |
131 return repack_locales(locales) | 133 return repack_locales(locales) |
132 | 134 |
133 if __name__ == '__main__': | 135 if __name__ == '__main__': |
134 results = DoMain(sys.argv[1:]) | 136 results = DoMain(sys.argv[1:]) |
135 if results: | 137 if results: |
136 print results | 138 print results |
OLD | NEW |