OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # | 7 # |
8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work | 8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work |
9 # because: | 9 # because: |
10 # | 10 # |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 _RemoveKeys(plist, | 197 _RemoveKeys(plist, |
198 'BreakpadURL', | 198 'BreakpadURL', |
199 'BreakpadReportInterval', | 199 'BreakpadReportInterval', |
200 'BreakpadProduct', | 200 'BreakpadProduct', |
201 'BreakpadProductDisplay', | 201 'BreakpadProductDisplay', |
202 'BreakpadVersion', | 202 'BreakpadVersion', |
203 'BreakpadSendAndExit', | 203 'BreakpadSendAndExit', |
204 'BreakpadSkipConfirm') | 204 'BreakpadSkipConfirm') |
205 | 205 |
206 | 206 |
207 def _TagSuffixes(): | |
208 # Keep this list sorted in the order that tag suffix components are to | |
209 # appear in a tag value. That is to say, it should be sorted per ASCII. | |
210 components = ('32bit', 'full') | |
Nico
2014/01/02 23:56:28
assert sorted(components) == components
Mark Mentovai
2014/01/03 16:46:41
Nico wrote:
| |
211 | |
212 components_len = len(components) | |
213 combinations = 1 << components_len | |
214 tag_suffixes = [] | |
215 for combination in xrange(0, combinations): | |
Nico
2014/01/02 23:56:28
start this at 1…
Mark Mentovai
2014/01/03 16:46:41
Nico wrote:
| |
216 tag_suffix = '' | |
217 for component_index in xrange(0, components_len): | |
218 if combination & 1 << component_index: | |
TVL
2014/01/03 00:09:40
do you want parens in here to be safe?
| |
219 tag_suffix += '-' + components[component_index] | |
220 tag_suffixes.append(tag_suffix) | |
221 return tag_suffixes | |
222 | |
223 | |
207 def _AddKeystoneKeys(plist, bundle_identifier): | 224 def _AddKeystoneKeys(plist, bundle_identifier): |
208 """Adds the Keystone keys. This must be called AFTER _AddVersionKeys() and | 225 """Adds the Keystone keys. This must be called AFTER _AddVersionKeys() and |
209 also requires the |bundle_identifier| argument (com.example.product).""" | 226 also requires the |bundle_identifier| argument (com.example.product).""" |
210 plist['KSVersion'] = plist['CFBundleShortVersionString'] | 227 plist['KSVersion'] = plist['CFBundleShortVersionString'] |
211 plist['KSProductID'] = bundle_identifier | 228 plist['KSProductID'] = bundle_identifier |
212 plist['KSUpdateURL'] = 'https://tools.google.com/service/update2' | 229 plist['KSUpdateURL'] = 'https://tools.google.com/service/update2' |
213 | 230 |
231 _RemoveKeys(plist, 'KSChannelID') | |
232 for tag_suffix in _TagSuffixes(): | |
233 if tag_suffix: | |
Nico
2014/01/02 23:56:28
…and remove this if
Also, this always adds all k
Mark Mentovai
2014/01/03 16:46:41
Nico wrote:
| |
234 plist['KSChannelID' + tag_suffix] = tag_suffix | |
235 | |
214 | 236 |
215 def _RemoveKeystoneKeys(plist): | 237 def _RemoveKeystoneKeys(plist): |
216 """Removes any set Keystone keys.""" | 238 """Removes any set Keystone keys.""" |
217 _RemoveKeys(plist, | 239 _RemoveKeys(plist, |
218 'KSVersion', | 240 'KSVersion', |
219 'KSProductID', | 241 'KSProductID', |
220 'KSUpdateURL') | 242 'KSUpdateURL') |
221 | 243 |
244 tag_keys = [] | |
245 for tag_suffix in _TagSuffixes(): | |
246 tag_keys.append('KSChannelID' + tag_suffix) | |
247 _RemoveKeys(plist, *tag_keys) | |
248 | |
222 | 249 |
223 def Main(argv): | 250 def Main(argv): |
224 parser = optparse.OptionParser('%prog [options]') | 251 parser = optparse.OptionParser('%prog [options]') |
225 parser.add_option('--breakpad', dest='use_breakpad', action='store', | 252 parser.add_option('--breakpad', dest='use_breakpad', action='store', |
226 type='int', default=False, help='Enable Breakpad [1 or 0]') | 253 type='int', default=False, help='Enable Breakpad [1 or 0]') |
227 parser.add_option('--breakpad_uploads', dest='breakpad_uploads', | 254 parser.add_option('--breakpad_uploads', dest='breakpad_uploads', |
228 action='store', type='int', default=False, | 255 action='store', type='int', default=False, |
229 help='Enable Breakpad\'s uploading of crash dumps [1 or 0]') | 256 help='Enable Breakpad\'s uploading of crash dumps [1 or 0]') |
230 parser.add_option('--keystone', dest='use_keystone', action='store', | 257 parser.add_option('--keystone', dest='use_keystone', action='store', |
231 type='int', default=False, help='Enable Keystone [1 or 0]') | 258 type='int', default=False, help='Enable Keystone [1 or 0]') |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 # Info.plist will work perfectly well in any plist format, but traditionally | 323 # Info.plist will work perfectly well in any plist format, but traditionally |
297 # applications use xml1 for this, so convert it to ensure that it's valid. | 324 # applications use xml1 for this, so convert it to ensure that it's valid. |
298 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, | 325 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, |
299 temp_info_plist.name]) | 326 temp_info_plist.name]) |
300 proc.wait() | 327 proc.wait() |
301 return proc.returncode | 328 return proc.returncode |
302 | 329 |
303 | 330 |
304 if __name__ == '__main__': | 331 if __name__ == '__main__': |
305 sys.exit(Main(sys.argv[1:])) | 332 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |