vndk-def: Add regex matching to tag file reader

This commit add regular expression support to tag file reader and stop
hard coding SP-HAL in vndk_definition_tool.py.

Test: ./tests/run.py
Test: Run vndk_definition_tool.py for a device and all outputs are same
Change-Id: Iae2631a965045e80c7373970e3f1e61209f3006a
This commit is contained in:
Logan Chien
2017-11-13 18:55:45 +08:00
parent 32f6640b14
commit 32f89a67fe
4 changed files with 115 additions and 70 deletions

View File

@@ -67,8 +67,12 @@ def main():
reader = csv.reader(fp)
header = next(reader)
data = dict()
regex_patterns = []
for path, tag, comments in reader:
data[path] = [path, tag, comments]
if path.startswith('[regex]'):
regex_patterns.append([path, tag, comments])
else:
data[path] = [path, tag, comments]
# Delete non-existing libraries.
installed_paths = load_install_paths(args.module_info)
@@ -100,6 +104,9 @@ def main():
update_tag('/system/${LIB}/' + name + '.so', 'VNDK')
update_tag('/system/${LIB}/vndk/' + name + '.so', 'VNDK')
for regex in regex_patterns:
data[regex[0]] = regex
# Write updated eligible list file.
with open(args.output, 'w') as fp:
writer = csv.writer(fp, lineterminator='\n')