Ole Troan | 5c318c7 | 2020-05-05 12:23:47 +0200 | [diff] [blame] | 1 | # CRC generation |
| 2 | import json |
| 3 | |
Paul Vinciguerra | 9046e44 | 2020-11-20 23:10:09 -0500 | [diff] [blame] | 4 | process_imports = True |
| 5 | |
| 6 | |
Ole Troan | 5c318c7 | 2020-05-05 12:23:47 +0200 | [diff] [blame] | 7 | # |
| 8 | # Plugin entry point |
| 9 | # |
| 10 | def run(args, input_filename, s): |
| 11 | j = {} |
| 12 | major = 0 |
| 13 | if 'version' in s['Option']: |
| 14 | v = s['Option']['version'] |
| 15 | (major, minor, patch) = v.split('.') |
| 16 | for t in s['Define']: |
| 17 | j[t.name] = {'crc': f'{t.crc:#08x}', 'version': major, |
| 18 | 'options': t.options} |
| 19 | return json.dumps(j, indent=4, separators=(',', ': ')) |