format_fingerprints: automatically sort fw fingerprints (#30819)

* Auto sort fingerprints

* add comment
This commit is contained in:
Justin Newberry
2023-12-20 11:54:31 -08:00
committed by GitHub
parent 05dc0b51e6
commit 3d8c78d6b3
11 changed files with 693 additions and 687 deletions
+6
View File
@@ -76,6 +76,12 @@ def format_brand_fw_versions(brand, extra_fw_versions: None | dict[str, dict[tup
with open(fingerprints_file, "r") as f:
comments = [line for line in f.readlines() if line.startswith("#") and "noqa" not in line]
# sort fw versions
if fw_versions[brand] is not None:
for platform in fw_versions[brand]:
for ecu in fw_versions[brand][platform]:
fw_versions[brand][platform][ecu] = sorted(fw_versions[brand][platform][ecu])
with open(fingerprints_file, "w") as f:
f.write(FINGERPRINTS_PY_TEMPLATE.render(brand=brand, comments=comments, ECU_NAME=ECU_NAME,
FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=fw_versions))