1 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
12 def ProcessInfoPlist(args
):
13 output_plist_file
= os
.path
.abspath(os
.path
.join(args
.output
, 'Info.plist'))
14 return subprocess
.check_call( [
27 def PerformCodeSigning(args
):
28 return subprocess
.check_call([
33 args
.entitlements_path
,
37 args
.application_path
,
41 def MakeDirectories(path
):
44 except OSError as exc
:
45 if exc
.errno
== errno
.EEXIST
and os
.path
.isdir(path
):
52 def GenerateProjectStructure(args
):
53 application_path
= os
.path
.join(args
.dir, args
.name
+ ".app")
54 return MakeDirectories( application_path
)
58 parser
= argparse
.ArgumentParser(description
='A script that aids in '
59 'the creation of an iOS application')
60 subparsers
= parser
.add_subparsers()
63 plist_parser
= subparsers
.add_parser('plist',
64 help='Process the Info.plist')
65 plist_parser
.set_defaults(func
=ProcessInfoPlist
)
67 plist_parser
.add_argument('-i', dest
='input', help='The input plist path')
68 plist_parser
.add_argument('-o', dest
='output', help='The output plist dir')
70 # Directory Structure Parser
71 dir_struct_parser
= subparsers
.add_parser('structure',
72 help='Creates the directory of an iOS application')
74 dir_struct_parser
.set_defaults(func
=GenerateProjectStructure
)
76 dir_struct_parser
.add_argument('-d', dest
='dir', help='Out directory')
77 dir_struct_parser
.add_argument('-n', dest
='name', help='App name')
80 code_signing_parser
= subparsers
.add_parser('codesign',
81 help='Code sign the specified application')
83 code_signing_parser
.set_defaults(func
=PerformCodeSigning
)
85 code_signing_parser
.add_argument('-p', dest
='application_path', required
=True,
86 help='The application path')
87 code_signing_parser
.add_argument('-i', dest
='identity', required
=True,
88 help='The code signing identity to use')
89 code_signing_parser
.add_argument('-e', dest
='entitlements_path',
91 help='The path to the entitlements .xcent')
94 args
= parser
.parse_args()
95 return args
.func(args
)
98 if __name__
== '__main__':