| 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') |
| 211 assert tuple(sorted(components)) == components |
| 212 |
| 213 components_len = len(components) |
| 214 combinations = 1 << components_len |
| 215 tag_suffixes = [] |
| 216 for combination in xrange(0, combinations): |
| 217 tag_suffix = '' |
| 218 for component_index in xrange(0, components_len): |
| 219 if combination & (1 << component_index): |
| 220 tag_suffix += '-' + components[component_index] |
| 221 tag_suffixes.append(tag_suffix) |
| 222 return tag_suffixes |
| 223 |
| 224 |
| 207 def _AddKeystoneKeys(plist, bundle_identifier): | 225 def _AddKeystoneKeys(plist, bundle_identifier): |
| 208 """Adds the Keystone keys. This must be called AFTER _AddVersionKeys() and | 226 """Adds the Keystone keys. This must be called AFTER _AddVersionKeys() and |
| 209 also requires the |bundle_identifier| argument (com.example.product).""" | 227 also requires the |bundle_identifier| argument (com.example.product).""" |
| 210 plist['KSVersion'] = plist['CFBundleShortVersionString'] | 228 plist['KSVersion'] = plist['CFBundleShortVersionString'] |
| 211 plist['KSProductID'] = bundle_identifier | 229 plist['KSProductID'] = bundle_identifier |
| 212 plist['KSUpdateURL'] = 'https://tools.google.com/service/update2' | 230 plist['KSUpdateURL'] = 'https://tools.google.com/service/update2' |
| 213 | 231 |
| 232 _RemoveKeys(plist, 'KSChannelID') |
| 233 for tag_suffix in _TagSuffixes(): |
| 234 if tag_suffix: |
| 235 plist['KSChannelID' + tag_suffix] = tag_suffix |
| 236 |
| 214 | 237 |
| 215 def _RemoveKeystoneKeys(plist): | 238 def _RemoveKeystoneKeys(plist): |
| 216 """Removes any set Keystone keys.""" | 239 """Removes any set Keystone keys.""" |
| 217 _RemoveKeys(plist, | 240 _RemoveKeys(plist, |
| 218 'KSVersion', | 241 'KSVersion', |
| 219 'KSProductID', | 242 'KSProductID', |
| 220 'KSUpdateURL') | 243 'KSUpdateURL') |
| 221 | 244 |
| 245 tag_keys = [] |
| 246 for tag_suffix in _TagSuffixes(): |
| 247 tag_keys.append('KSChannelID' + tag_suffix) |
| 248 _RemoveKeys(plist, *tag_keys) |
| 249 |
| 222 | 250 |
| 223 def Main(argv): | 251 def Main(argv): |
| 224 parser = optparse.OptionParser('%prog [options]') | 252 parser = optparse.OptionParser('%prog [options]') |
| 225 parser.add_option('--breakpad', dest='use_breakpad', action='store', | 253 parser.add_option('--breakpad', dest='use_breakpad', action='store', |
| 226 type='int', default=False, help='Enable Breakpad [1 or 0]') | 254 type='int', default=False, help='Enable Breakpad [1 or 0]') |
| 227 parser.add_option('--breakpad_uploads', dest='breakpad_uploads', | 255 parser.add_option('--breakpad_uploads', dest='breakpad_uploads', |
| 228 action='store', type='int', default=False, | 256 action='store', type='int', default=False, |
| 229 help='Enable Breakpad\'s uploading of crash dumps [1 or 0]') | 257 help='Enable Breakpad\'s uploading of crash dumps [1 or 0]') |
| 230 parser.add_option('--keystone', dest='use_keystone', action='store', | 258 parser.add_option('--keystone', dest='use_keystone', action='store', |
| 231 type='int', default=False, help='Enable Keystone [1 or 0]') | 259 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 | 324 # 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. | 325 # 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, | 326 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, |
| 299 temp_info_plist.name]) | 327 temp_info_plist.name]) |
| 300 proc.wait() | 328 proc.wait() |
| 301 return proc.returncode | 329 return proc.returncode |
| 302 | 330 |
| 303 | 331 |
| 304 if __name__ == '__main__': | 332 if __name__ == '__main__': |
| 305 sys.exit(Main(sys.argv[1:])) | 333 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |