blob: 791e347292eea1d3af417691d70a59a9cd01d9b5 [file] [log] [blame]
Ole Troan5c318c72020-05-05 12:23:47 +02001# CRC generation
2import json
3
Paul Vinciguerra9046e442020-11-20 23:10:09 -05004process_imports = True
5
6
Ole Troan5c318c72020-05-05 12:23:47 +02007#
8# Plugin entry point
9#
10def run(args, input_filename, s):
11 j = {}
12 major = 0
Ole Troanab9f5732020-12-15 10:19:25 +010013 minor = 0
14 patch = 0
Ole Troan5c318c72020-05-05 12:23:47 +020015 if 'version' in s['Option']:
16 v = s['Option']['version']
17 (major, minor, patch) = v.split('.')
Ole Troanab9f5732020-12-15 10:19:25 +010018 j['_version'] = {'major': major, 'minor': minor, 'patch': patch}
Ole Troan5c318c72020-05-05 12:23:47 +020019 for t in s['Define']:
20 j[t.name] = {'crc': f'{t.crc:#08x}', 'version': major,
21 'options': t.options}
22 return json.dumps(j, indent=4, separators=(',', ': '))