| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import fnmatch | 6 import fnmatch |
| 7 import glob | 7 import glob |
| 8 import os | 8 import os |
| 9 import plistlib | 9 import plistlib |
| 10 import shutil | 10 import shutil |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 help='path to the entitlements file to use') | 261 help='path to the entitlements file to use') |
| 262 parser.add_argument( | 262 parser.add_argument( |
| 263 'path', help='path to the iOS bundle to codesign') | 263 'path', help='path to the iOS bundle to codesign') |
| 264 parser.add_argument( | 264 parser.add_argument( |
| 265 '--identity', '-i', required=True, | 265 '--identity', '-i', required=True, |
| 266 help='identity to use to codesign') | 266 help='identity to use to codesign') |
| 267 parser.add_argument( | 267 parser.add_argument( |
| 268 '--binary', '-b', required=True, | 268 '--binary', '-b', required=True, |
| 269 help='path to the iOS bundle binary') | 269 help='path to the iOS bundle binary') |
| 270 parser.add_argument( | 270 parser.add_argument( |
| 271 '--framework', '-F', action='append', default=[], dest="frameworks", | 271 '--framework', '-F', action='append', default=[], dest='frameworks', |
| 272 help='install and resign system framework') | 272 help='install and resign system framework') |
| 273 parser.add_argument( |
| 274 '--disable-code-signature', action='store_false', dest='sign', |
| 275 help='disable code signature') |
| 276 parser.set_defaults(sign=True) |
| 273 | 277 |
| 274 @staticmethod | 278 @staticmethod |
| 275 def _Execute(args): | 279 def _Execute(args): |
| 276 if not args.identity: | 280 if not args.identity: |
| 277 args.identity = '-' | 281 args.identity = '-' |
| 278 | 282 |
| 279 bundle = Bundle(args.path) | 283 bundle = Bundle(args.path) |
| 280 | 284 |
| 281 # Find mobile provisioning profile and embeds it into the bundle (if a code | 285 # Find mobile provisioning profile and embeds it into the bundle (if a code |
| 282 # signing identify has been provided, fails if no valid mobile provisioning | 286 # signing identify has been provided, fails if no valid mobile provisioning |
| (...skipping 11 matching lines...) Expand all Loading... |
| 294 | 298 |
| 295 # Install system frameworks if requested. | 299 # Install system frameworks if requested. |
| 296 for framework_path in args.frameworks: | 300 for framework_path in args.frameworks: |
| 297 InstallSystemFramework(framework_path, args.path, args) | 301 InstallSystemFramework(framework_path, args.path, args) |
| 298 | 302 |
| 299 # Copy main binary into bundle. | 303 # Copy main binary into bundle. |
| 300 if os.path.isfile(bundle.binary_path): | 304 if os.path.isfile(bundle.binary_path): |
| 301 os.unlink(bundle.binary_path) | 305 os.unlink(bundle.binary_path) |
| 302 shutil.copy(args.binary, bundle.binary_path) | 306 shutil.copy(args.binary, bundle.binary_path) |
| 303 | 307 |
| 308 if not args.sign: |
| 309 return |
| 310 |
| 304 # Embeds entitlements into the code signature (if code signing identify has | 311 # Embeds entitlements into the code signature (if code signing identify has |
| 305 # been provided). | 312 # been provided). |
| 306 codesign_extra_args = [] | 313 codesign_extra_args = [] |
| 307 if provisioning_profile: | 314 if provisioning_profile: |
| 308 temporary_entitlements_file = tempfile.NamedTemporaryFile(suffix='.xcent') | 315 temporary_entitlements_file = tempfile.NamedTemporaryFile(suffix='.xcent') |
| 309 codesign_extra_args.extend( | 316 codesign_extra_args.extend( |
| 310 ['--entitlements', temporary_entitlements_file.name]) | 317 ['--entitlements', temporary_entitlements_file.name]) |
| 311 | 318 |
| 312 entitlements = GenerateEntitlements( | 319 entitlements = GenerateEntitlements( |
| 313 args.entitlements_path, provisioning_profile, bundle.identifier) | 320 args.entitlements_path, provisioning_profile, bundle.identifier) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 362 |
| 356 for action in [ CodeSignBundleAction, GenerateEntitlementsAction ]: | 363 for action in [ CodeSignBundleAction, GenerateEntitlementsAction ]: |
| 357 action.Register(subparsers) | 364 action.Register(subparsers) |
| 358 | 365 |
| 359 args = parser.parse_args() | 366 args = parser.parse_args() |
| 360 args.func(args) | 367 args.func(args) |
| 361 | 368 |
| 362 | 369 |
| 363 if __name__ == '__main__': | 370 if __name__ == '__main__': |
| 364 sys.exit(Main()) | 371 sys.exit(Main()) |
| OLD | NEW |