Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
gen_app_invocation Namespace Reference

Functions

 main ()
 

Function Documentation

◆ main()

gen_app_invocation.main ( )

Definition at line 13 of file gen_app_invocation.py.

13def main():
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()
19
20 app_file = args.out
21 app_path = os.path.dirname(app_file)
22 if not os.path.exists(app_path):
23 os.makedirs(app_path)
24
25 script_template = string.Template('''#!/bin/sh
26
27$dart \\
28 $snapshot \\
29 "$$@"
30''')
31 with open(app_file, 'w') as file:
32 file.write(script_template.substitute(args.__dict__))
33 permissions = (
34 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP
35 | stat.S_IXGRP | stat.S_IROTH
36 )
37 os.chmod(app_file, permissions)
38
39
Definition main.py:1