blob: f7e8296af3ef5d90a9f7db2c3ec6429e5b43e2c2 [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#
Nathan Skrzypczak1b299fa2022-06-16 17:00:02 +020010def run(output_dir, input_filename, s):
Ole Troan5c318c72020-05-05 12:23:47 +020011 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=(",", ": "))