blob: 525f6c07efc29e88b0563b691e7c14386c388bfc [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
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020015 if "version" in s["Option"]:
16 v = s["Option"]["version"]
17 (major, minor, patch) = v.split(".")
18 j["_version"] = {"major": major, "minor": minor, "patch": patch}
19 for t in s["Define"]:
20 j[t.name] = {"crc": f"{t.crc:#08x}", "version": major, "options": t.options}
21 return json.dumps(j, indent=4, separators=(",", ": "))