Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
convert_manifest_to_json Namespace Reference

Functions

 collect (path_prefix, lines)
 
 main ()
 

Variables

 Entry = collections.namedtuple('Entry', ['source', 'dest'])
 

Detailed Description

Reads the contents of a kernel manifest generated by the build and
  converts it to a format suitable for distribution_entries

Function Documentation

◆ collect()

convert_manifest_to_json.collect (   path_prefix,
  lines 
)
Reads the kernel manifest and creates an array of Entry objects.
  - lines: a list of lines from the manifest

Definition at line 19 of file convert_manifest_to_json.py.

19def collect(path_prefix, lines):
20 '''Reads the kernel manifest and creates an array of Entry objects.
21 - lines: a list of lines from the manifest
22 '''
23 entries = []
24 for line in lines:
25 values = line.split("=", 1)
26 entries.append(Entry(source=path_prefix + values[1], dest=values[0]))
27
28 return entries
29
30

◆ main()

convert_manifest_to_json.main ( )

Definition at line 31 of file convert_manifest_to_json.py.

31def main():
32 parser = argparse.ArgumentParser(description=__doc__)
33 parser.add_argument(
34 '--path_prefix', help='Directory path containing the manifest entry sources', required=True
35 )
36 parser.add_argument('--input', help='Path to original manifest', required=True)
37 parser.add_argument('--output', help='Path to the updated json file', required=True)
38 args = parser.parse_args()
39
40 with open(args.input, 'r') as input_file:
41 contents = input_file.read().splitlines()
42
43 entries = collect(args.path_prefix, contents)
44
45 if entries is None:
46 return 1
47
48 with open(args.output, 'w') as output_file:
49 json.dump([e._asdict() for e in entries],
50 output_file,
51 indent=2,
52 sort_keys=True,
53 separators=(',', ': '))
54
55 return 0
56
57
Definition main.py:1

Variable Documentation

◆ Entry

convert_manifest_to_json.Entry = collections.namedtuple('Entry', ['source', 'dest'])

Definition at line 16 of file convert_manifest_to_json.py.