Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: trunk/src/chrome/tools/build/repack_locales.py

Issue 383373002: Revert 282837 because it broke non-chromeos builds. (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 """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 11 matching lines...) Expand all
22 BRANDING = None 22 BRANDING = None
23 23
24 # Some build paths defined by gyp. 24 # Some build paths defined by gyp.
25 GRIT_DIR = None 25 GRIT_DIR = None
26 SHARE_INT_DIR = None 26 SHARE_INT_DIR = None
27 INT_DIR = None 27 INT_DIR = None
28 28
29 # The target platform. If it is not defined, sys.platform will be used. 29 # The target platform. If it is not defined, sys.platform will be used.
30 OS = None 30 OS = None
31 31
32 # Note that OS is normally set to 'linux' when building for chromeos.
33 CHROMEOS = False
34
35 USE_ASH = False 32 USE_ASH = False
36 ENABLE_AUTOFILL_DIALOG = False 33 ENABLE_AUTOFILL_DIALOG = False
37 34
38 WHITELIST = None 35 WHITELIST = None
39 36
40 # Extra input files. 37 # Extra input files.
41 EXTRA_INPUT_FILES = [] 38 EXTRA_INPUT_FILES = []
42 39
43 class Usage(Exception): 40 class Usage(Exception):
44 def __init__(self, msg): 41 def __init__(self, msg):
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #e.g. '<(SHARED_INTERMEDIATE_DIR)/components/strings/ 77 #e.g. '<(SHARED_INTERMEDIATE_DIR)/components/strings/
81 # components_strings_da.pak', 78 # components_strings_da.pak',
82 inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings', 79 inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings',
83 'components_strings_%s.pak' % locale)) 80 'components_strings_%s.pak' % locale))
84 81
85 if USE_ASH: 82 if USE_ASH:
86 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ash/strings/ash_strings_da.pak', 83 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ash/strings/ash_strings_da.pak',
87 inputs.append(os.path.join(SHARE_INT_DIR, 'ash', 'strings', 84 inputs.append(os.path.join(SHARE_INT_DIR, 'ash', 'strings',
88 'ash_strings_%s.pak' % locale)) 85 'ash_strings_%s.pak' % locale))
89 86
90 if CHROMEOS:
91 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'chromeos', 'strings',
92 'ui_chromeos_strings_%s.pak' % locale))
93
94 if OS != 'ios': 87 if OS != 'ios':
95 #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak' 88 #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak'
96 inputs.append(os.path.join(SHARE_INT_DIR, 'webkit', 89 inputs.append(os.path.join(SHARE_INT_DIR, 'webkit',
97 'webkit_strings_%s.pak' % locale)) 90 'webkit_strings_%s.pak' % locale))
98 91
99 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings_da.pak', 92 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings_da.pak',
100 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings', 93 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
101 'ui_strings_%s.pak' % locale)) 94 'ui_strings_%s.pak' % locale))
102 95
103 #e.g. '<(SHARED_INTERMEDIATE_DIR)/device/bluetooth/strings/ 96 #e.g. '<(SHARED_INTERMEDIATE_DIR)/device/bluetooth/strings/
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 output = calc_output(locale) 169 output = calc_output(locale)
177 data_pack.DataPack.RePack(output, inputs, whitelist_file=WHITELIST) 170 data_pack.DataPack.RePack(output, inputs, whitelist_file=WHITELIST)
178 171
179 172
180 def DoMain(argv): 173 def DoMain(argv):
181 global BRANDING 174 global BRANDING
182 global GRIT_DIR 175 global GRIT_DIR
183 global SHARE_INT_DIR 176 global SHARE_INT_DIR
184 global INT_DIR 177 global INT_DIR
185 global OS 178 global OS
186 global CHROMEOS
187 global USE_ASH 179 global USE_ASH
188 global WHITELIST 180 global WHITELIST
189 global ENABLE_AUTOFILL_DIALOG 181 global ENABLE_AUTOFILL_DIALOG
190 global EXTRA_INPUT_FILES 182 global EXTRA_INPUT_FILES
191 183
192 parser = optparse.OptionParser("usage: %prog [options] locales") 184 parser = optparse.OptionParser("usage: %prog [options] locales")
193 parser.add_option("-i", action="store_true", dest="inputs", default=False, 185 parser.add_option("-i", action="store_true", dest="inputs", default=False,
194 help="Print the expected input file list, then exit.") 186 help="Print the expected input file list, then exit.")
195 parser.add_option("-o", action="store_true", dest="outputs", default=False, 187 parser.add_option("-o", action="store_true", dest="outputs", default=False,
196 help="Print the expected output file list, then exit.") 188 help="Print the expected output file list, then exit.")
197 parser.add_option("-g", action="store", dest="grit_dir", 189 parser.add_option("-g", action="store", dest="grit_dir",
198 help="GRIT build files output directory.") 190 help="GRIT build files output directory.")
199 parser.add_option("-x", action="store", dest="int_dir", 191 parser.add_option("-x", action="store", dest="int_dir",
200 help="Intermediate build files output directory.") 192 help="Intermediate build files output directory.")
201 parser.add_option("-s", action="store", dest="share_int_dir", 193 parser.add_option("-s", action="store", dest="share_int_dir",
202 help="Shared intermediate build files output directory.") 194 help="Shared intermediate build files output directory.")
203 parser.add_option("-b", action="store", dest="branding", 195 parser.add_option("-b", action="store", dest="branding",
204 help="Branding type of this build.") 196 help="Branding type of this build.")
205 parser.add_option("-e", action="append", dest="extra_input", default=[], 197 parser.add_option("-e", action="append", dest="extra_input", default=[],
206 help="Full path to an extra input pak file without the\ 198 help="Full path to an extra input pak file without the\
207 locale suffix and \".pak\" extension.") 199 locale suffix and \".pak\" extension.")
208 parser.add_option("-p", action="store", dest="os", 200 parser.add_option("-p", action="store", dest="os",
209 help="The target OS. (e.g. mac, linux, win, etc.)") 201 help="The target OS. (e.g. mac, linux, win, etc.)")
210 parser.add_option("--use-ash", action="store", dest="use_ash", 202 parser.add_option("--use-ash", action="store", dest="use_ash",
211 help="Whether to include ash strings") 203 help="Whether to include ash strings")
212 parser.add_option("--chromeos", action="store_true",
213 help="Whether building for Chrome OS", default = False)
214 parser.add_option("--whitelist", action="store", help="Full path to the " 204 parser.add_option("--whitelist", action="store", help="Full path to the "
215 "whitelist used to filter output pak file resource IDs") 205 "whitelist used to filter output pak file resource IDs")
216 parser.add_option("--enable-autofill-dialog", action="store", 206 parser.add_option("--enable-autofill-dialog", action="store",
217 dest="enable_autofill_dialog", 207 dest="enable_autofill_dialog",
218 help="Whether to include strings for autofill dialog") 208 help="Whether to include strings for autofill dialog")
219 options, locales = parser.parse_args(argv) 209 options, locales = parser.parse_args(argv)
220 210
221 if not locales: 211 if not locales:
222 parser.error('Please specificy at least one locale to process.\n') 212 parser.error('Please specificy at least one locale to process.\n')
223 213
224 print_inputs = options.inputs 214 print_inputs = options.inputs
225 print_outputs = options.outputs 215 print_outputs = options.outputs
226 GRIT_DIR = options.grit_dir 216 GRIT_DIR = options.grit_dir
227 INT_DIR = options.int_dir 217 INT_DIR = options.int_dir
228 SHARE_INT_DIR = options.share_int_dir 218 SHARE_INT_DIR = options.share_int_dir
229 BRANDING = options.branding 219 BRANDING = options.branding
230 EXTRA_INPUT_FILES = options.extra_input 220 EXTRA_INPUT_FILES = options.extra_input
231 OS = options.os 221 OS = options.os
232 CHROMEOS = options.chromeos
233 USE_ASH = options.use_ash == '1' 222 USE_ASH = options.use_ash == '1'
234 WHITELIST = options.whitelist 223 WHITELIST = options.whitelist
235 ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1' 224 ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1'
236 225
237 if not OS: 226 if not OS:
238 if sys.platform == 'darwin': 227 if sys.platform == 'darwin':
239 OS = 'mac' 228 OS = 'mac'
240 elif sys.platform.startswith('linux'): 229 elif sys.platform.startswith('linux'):
241 OS = 'linux' 230 OS = 'linux'
242 elif sys.platform in ('cygwin', 'win32'): 231 elif sys.platform in ('cygwin', 'win32'):
(...skipping 14 matching lines...) Expand all
257 246
258 if print_outputs: 247 if print_outputs:
259 return list_outputs(locales) 248 return list_outputs(locales)
260 249
261 return repack_locales(locales) 250 return repack_locales(locales)
262 251
263 if __name__ == '__main__': 252 if __name__ == '__main__':
264 results = DoMain(sys.argv[1:]) 253 results = DoMain(sys.argv[1:])
265 if results: 254 if results:
266 print results 255 print results
OLDNEW
« no previous file with comments | « trunk/src/chrome/chrome_resources.gyp ('k') | trunk/src/chrome/tools/check_grd_for_unused_strings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698