12PLUTIL = [
'/usr/bin/env',
'xcrun',
'plutil']
24 except OSError
as exc:
25 if exc.errno == errno.EEXIST
and os.path.isdir(path):
34 output_plist_file = os.path.abspath(os.path.join(args.output,
'Info.plist'))
35 return subprocess.check_call(PLUTIL + [
46 output_nib_file = os.path.join(
47 os.path.abspath(args.output),
48 "%s.nib" % os.path.splitext(os.path.basename(args.input))[0])
50 return subprocess.check_call(IBTOOL + [
53 '--auto-activate-custom-fonts',
58 os.path.abspath(args.input),
63 application_path = os.path.join(args.dir, args.name +
".app",
"Contents")
68 parser = argparse.ArgumentParser(description=
'A script that aids in '
69 'the creation of an Mac application')
71 subparsers = parser.add_subparsers()
75 plist_parser = subparsers.add_parser(
'plist', help=
'Process the Info.plist')
76 plist_parser.set_defaults(func=ProcessInfoPlist)
78 plist_parser.add_argument(
'-i', dest=
'input', help=
'The input plist path')
79 plist_parser.add_argument(
'-o', dest=
'output', help=
'The output plist dir')
83 plist_parser = subparsers.add_parser(
'nib', help=
'Process a NIB file')
84 plist_parser.set_defaults(func=ProcessNIB)
86 plist_parser.add_argument(
'-i', dest=
'input', help=
'The input nib path')
87 plist_parser.add_argument(
'-o', dest=
'output', help=
'The output nib dir')
88 plist_parser.add_argument(
'-m', dest=
'module', help=
'The module name')
92 dir_struct_parser = subparsers.add_parser(
93 'structure', help=
'Creates the directory of an Mac application')
95 dir_struct_parser.set_defaults(func=GenerateProjectStructure)
97 dir_struct_parser.add_argument(
'-d', dest=
'dir', help=
'Out directory')
98 dir_struct_parser.add_argument(
'-n', dest=
'name', help=
'App name')
102 args = parser.parse_args()
104 return args.func(args)
107if __name__ ==
'__main__':
def GenerateProjectStructure(args)
def MakeDirectories(path)
def ProcessInfoPlist(args)