1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-10-15 12:29:13 +00:00
trezor-firmware/protob/check.py

24 lines
690 B
Python
Executable File

#!/usr/bin/env python3
from glob import glob
import sys
error = False
for fn in sorted(glob("messages-*.proto")):
with open(fn, "rt") as f:
prefix = fn.split(".")[0][9:].capitalize()
if prefix in ["Bitcoin", "Bootloader", "Common", "Crypto", "Management"]:
continue
if prefix == "Nem":
prefix = "NEM"
for line in f:
line = line.strip().split(" ")
if line[0] not in ["enum", "message"]:
continue
if not line[1].startswith(prefix) and not line[1].startswith("Debug" + prefix):
print("ERROR:", fn, line[1])
error = True
if error:
sys.exit(1)