14 parser = argparse.ArgumentParser(description=
'Generate a script that invokes a Dart application')
15 parser.add_argument(
'--out', help=
'Path to the invocation file to generate', required=
True)
16 parser.add_argument(
'--dart', help=
'Path to the Dart binary', required=
True)
17 parser.add_argument(
'--snapshot', help=
'Path to the app snapshot', required=
True)
18 args = parser.parse_args()
21 app_path = os.path.dirname(app_file)
22 if not os.path.exists(app_path):
25 script_template = string.Template(
'''#!/bin/sh
31 with open(app_file,
'w')
as file:
32 file.write(script_template.substitute(args.__dict__))
34 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP
35 | stat.S_IXGRP | stat.S_IROTH
37 os.chmod(app_file, permissions)
40if __name__ ==
'__main__':