Chromium Code Reviews| Index: build/config/ios/codesign.py |
| diff --git a/build/config/ios/codesign.py b/build/config/ios/codesign.py |
| index 3d66b246837b4994b675ade0fba033198a087b11..9e799d542481d67091fb6a71394d7f4871ac4bc5 100644 |
| --- a/build/config/ios/codesign.py |
| +++ b/build/config/ios/codesign.py |
| @@ -321,6 +321,49 @@ class CodeSignBundleAction(Action): |
| CodeSignBundle(bundle.path, args.identity, codesign_extra_args) |
| +class CodeSignFileAction(Action): |
| + |
|
justincohen
2016/09/27 18:08:23
nit empty line
sdefresne
2016/09/28 14:01:46
Done.
|
| + """Class implementing code signature for a single file.""" |
| + |
| + name = 'code-sign-file' |
| + help = 'code-sign a single file' |
| + |
| + @staticmethod |
| + def _Register(parser): |
| + parser.add_argument( |
| + 'path', help='path to the file to codesign') |
| + parser.add_argument( |
| + '--identity', '-i', required=True, |
| + help='identity to use to codesign') |
| + parser.add_argument( |
| + '--output', '-o', |
| + help='if specified copy the file to that location before signing it') |
| + parser.set_defaults(sign=True) |
| + |
| + @staticmethod |
| + def _Execute(args): |
| + if not args.identity: |
| + args.identity = '-' |
| + |
| + install_path = args.path |
| + if args.output: |
| + |
| + if os.path.isfile(args.output): |
| + os.unlink(args.output) |
| + elif os.path.isdir(args.output): |
| + shutil.rmtree(args.output) |
| + |
| + if os.path.isfile(args.path): |
| + shutil.copy(args.path, args.output) |
| + elif os.path.isdir(args.path): |
| + shutil.copytree(args.path, args.output) |
| + |
| + install_path = args.output |
| + |
| + CodeSignBundle(install_path, args.identity, |
| + ['--deep', '--preserve-metadata=identifier,entitlements']) |
| + |
| + |
| class GenerateEntitlementsAction(Action): |
|
justincohen
2016/09/27 18:08:23
nit empty line
sdefresne
2016/09/28 14:01:46
Done.
|
| """Class implementing the generate-entitlements action.""" |
| @@ -353,7 +396,13 @@ def Main(): |
| parser = argparse.ArgumentParser('codesign iOS bundles') |
| subparsers = parser.add_subparsers() |
| - for action in [ CodeSignBundleAction, GenerateEntitlementsAction ]: |
| + actions = [ |
| + CodeSignBundleAction, |
| + CodeSignFileAction, |
| + GenerateEntitlementsAction, |
| + ] |
| + |
| + for action in actions: |
| action.Register(subparsers) |
| args = parser.parse_args() |