2019-03-13 15:59:26 +00:00
|
|
|
#!/usr/bin/env python3
|
2019-03-21 11:22:55 +00:00
|
|
|
import os
|
2019-03-21 11:30:37 +00:00
|
|
|
import re
|
2019-03-13 15:59:26 +00:00
|
|
|
import sys
|
2019-04-18 14:27:27 +00:00
|
|
|
from glob import glob
|
2019-03-13 15:59:26 +00:00
|
|
|
|
|
|
|
error = False
|
|
|
|
|
2019-03-21 11:22:55 +00:00
|
|
|
MYDIR = os.path.dirname(__file__)
|
|
|
|
|
2019-03-21 11:30:37 +00:00
|
|
|
EXPECTED_PREFIX_RE = re.compile(r"messages-(\w+)\.proto")
|
|
|
|
|
2019-03-21 11:22:55 +00:00
|
|
|
for fn in sorted(glob(os.path.join(MYDIR, "messages-*.proto"))):
|
2019-03-13 15:59:26 +00:00
|
|
|
with open(fn, "rt") as f:
|
2019-03-21 11:30:37 +00:00
|
|
|
prefix = EXPECTED_PREFIX_RE.search(fn).group(1).capitalize()
|
2019-03-13 15:59:26 +00:00
|
|
|
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
|
2019-04-18 14:27:27 +00:00
|
|
|
if not line[1].startswith(prefix) and not line[1].startswith(
|
|
|
|
"Debug" + prefix
|
|
|
|
):
|
2019-03-13 15:59:26 +00:00
|
|
|
print("ERROR:", fn, line[1])
|
|
|
|
error = True
|
|
|
|
|
|
|
|
if error:
|
|
|
|
sys.exit(1)
|