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

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

Issue 178193032: Fix ui_unittests building with enable_autofill_dialog=0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix duplicate arguments Created 6 years, 7 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
« no previous file with comments | « chrome/chrome_repack_locales.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
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 USE_ASH = False 32 USE_ASH = False
33 ENABLE_AUTOFILL_DIALOG = False
33 34
34 WHITELIST = None 35 WHITELIST = None
35 36
36 # Extra input files. 37 # Extra input files.
37 EXTRA_INPUT_FILES = [] 38 EXTRA_INPUT_FILES = []
38 39
39 class Usage(Exception): 40 class Usage(Exception):
40 def __init__(self, msg): 41 def __init__(self, msg):
41 self.msg = msg 42 self.msg = msg
42 43
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'app_locale_settings', 102 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'app_locale_settings',
102 'app_locale_settings_%s.pak' % locale)) 103 'app_locale_settings_%s.pak' % locale))
103 104
104 # For example: 105 # For example:
105 # '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_da.pak 106 # '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_da.pak
106 # TODO(jamescook): When Android stops building extensions code move this 107 # TODO(jamescook): When Android stops building extensions code move this
107 # to the OS != 'ios' and OS != 'android' section below. 108 # to the OS != 'ios' and OS != 'android' section below.
108 inputs.append(os.path.join(SHARE_INT_DIR, 'extensions', 'strings', 109 inputs.append(os.path.join(SHARE_INT_DIR, 'extensions', 'strings',
109 'extensions_strings_%s.pak' % locale)) 110 'extensions_strings_%s.pak' % locale))
110 111
111 if OS != 'ios' and OS != 'android': 112 if ENABLE_AUTOFILL_DIALOG and OS != 'ios' and OS != 'android':
112 #e.g. '<(SHARED_INTERMEDIATE_DIR)/third_party/libaddressinput/ 113 #e.g. '<(SHARED_INTERMEDIATE_DIR)/third_party/libaddressinput/
113 # libaddressinput_strings_da.pak', 114 # libaddressinput_strings_da.pak',
114 inputs.append(os.path.join(SHARE_INT_DIR, 'third_party', 'libaddressinput', 115 inputs.append(os.path.join(SHARE_INT_DIR, 'third_party', 'libaddressinput',
115 'libaddressinput_strings_%s.pak' % locale)) 116 'libaddressinput_strings_%s.pak' % locale))
116 117
117 #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak' 118 #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak'
118 # or 119 # or
119 # '<(grit_out_dir)/chromium_strings_da.pak' 120 # '<(grit_out_dir)/chromium_strings_da.pak'
120 inputs.append(os.path.join( 121 inputs.append(os.path.join(
121 GRIT_DIR, '%s_strings_%s.pak' % (BRANDING, locale))) 122 GRIT_DIR, '%s_strings_%s.pak' % (BRANDING, locale)))
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 166
166 167
167 def DoMain(argv): 168 def DoMain(argv):
168 global BRANDING 169 global BRANDING
169 global GRIT_DIR 170 global GRIT_DIR
170 global SHARE_INT_DIR 171 global SHARE_INT_DIR
171 global INT_DIR 172 global INT_DIR
172 global OS 173 global OS
173 global USE_ASH 174 global USE_ASH
174 global WHITELIST 175 global WHITELIST
176 global ENABLE_AUTOFILL_DIALOG
175 global EXTRA_INPUT_FILES 177 global EXTRA_INPUT_FILES
176 178
177 parser = optparse.OptionParser("usage: %prog [options] locales") 179 parser = optparse.OptionParser("usage: %prog [options] locales")
178 parser.add_option("-i", action="store_true", dest="inputs", default=False, 180 parser.add_option("-i", action="store_true", dest="inputs", default=False,
179 help="Print the expected input file list, then exit.") 181 help="Print the expected input file list, then exit.")
180 parser.add_option("-o", action="store_true", dest="outputs", default=False, 182 parser.add_option("-o", action="store_true", dest="outputs", default=False,
181 help="Print the expected output file list, then exit.") 183 help="Print the expected output file list, then exit.")
182 parser.add_option("-g", action="store", dest="grit_dir", 184 parser.add_option("-g", action="store", dest="grit_dir",
183 help="GRIT build files output directory.") 185 help="GRIT build files output directory.")
184 parser.add_option("-x", action="store", dest="int_dir", 186 parser.add_option("-x", action="store", dest="int_dir",
185 help="Intermediate build files output directory.") 187 help="Intermediate build files output directory.")
186 parser.add_option("-s", action="store", dest="share_int_dir", 188 parser.add_option("-s", action="store", dest="share_int_dir",
187 help="Shared intermediate build files output directory.") 189 help="Shared intermediate build files output directory.")
188 parser.add_option("-b", action="store", dest="branding", 190 parser.add_option("-b", action="store", dest="branding",
189 help="Branding type of this build.") 191 help="Branding type of this build.")
190 parser.add_option("-e", action="append", dest="extra_input", default=[], 192 parser.add_option("-e", action="append", dest="extra_input", default=[],
191 help="Full path to an extra input pak file without the\ 193 help="Full path to an extra input pak file without the\
192 locale suffix and \".pak\" extension.") 194 locale suffix and \".pak\" extension.")
193 parser.add_option("-p", action="store", dest="os", 195 parser.add_option("-p", action="store", dest="os",
194 help="The target OS. (e.g. mac, linux, win, etc.)") 196 help="The target OS. (e.g. mac, linux, win, etc.)")
195 parser.add_option("--use-ash", action="store", dest="use_ash", 197 parser.add_option("--use-ash", action="store", dest="use_ash",
196 help="Whether to include ash strings") 198 help="Whether to include ash strings")
197 parser.add_option("--whitelist", action="store", help="Full path to the " 199 parser.add_option("--whitelist", action="store", help="Full path to the "
198 "whitelist used to filter output pak file resource IDs") 200 "whitelist used to filter output pak file resource IDs")
201 parser.add_option("--enable-autofill-dialog", action="store",
202 dest="enable_autofill_dialog",
203 help="Whether to include strings for autofill dialog")
199 options, locales = parser.parse_args(argv) 204 options, locales = parser.parse_args(argv)
200 205
201 if not locales: 206 if not locales:
202 parser.error('Please specificy at least one locale to process.\n') 207 parser.error('Please specificy at least one locale to process.\n')
203 208
204 print_inputs = options.inputs 209 print_inputs = options.inputs
205 print_outputs = options.outputs 210 print_outputs = options.outputs
206 GRIT_DIR = options.grit_dir 211 GRIT_DIR = options.grit_dir
207 INT_DIR = options.int_dir 212 INT_DIR = options.int_dir
208 SHARE_INT_DIR = options.share_int_dir 213 SHARE_INT_DIR = options.share_int_dir
209 BRANDING = options.branding 214 BRANDING = options.branding
210 EXTRA_INPUT_FILES = options.extra_input 215 EXTRA_INPUT_FILES = options.extra_input
211 OS = options.os 216 OS = options.os
212 USE_ASH = options.use_ash == '1' 217 USE_ASH = options.use_ash == '1'
213 WHITELIST = options.whitelist 218 WHITELIST = options.whitelist
219 ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1'
214 220
215 if not OS: 221 if not OS:
216 if sys.platform == 'darwin': 222 if sys.platform == 'darwin':
217 OS = 'mac' 223 OS = 'mac'
218 elif sys.platform.startswith('linux'): 224 elif sys.platform.startswith('linux'):
219 OS = 'linux' 225 OS = 'linux'
220 elif sys.platform in ('cygwin', 'win32'): 226 elif sys.platform in ('cygwin', 'win32'):
221 OS = 'win' 227 OS = 'win'
222 else: 228 else:
223 OS = sys.platform 229 OS = sys.platform
(...skipping 11 matching lines...) Expand all
235 241
236 if print_outputs: 242 if print_outputs:
237 return list_outputs(locales) 243 return list_outputs(locales)
238 244
239 return repack_locales(locales) 245 return repack_locales(locales)
240 246
241 if __name__ == '__main__': 247 if __name__ == '__main__':
242 results = DoMain(sys.argv[1:]) 248 results = DoMain(sys.argv[1:])
243 if results: 249 if results:
244 print results 250 print results
OLDNEW
« no previous file with comments | « chrome/chrome_repack_locales.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698