14 lines
735 B
Python
14 lines
735 B
Python
#!/usr/bin/env python3
|
|
"""Synchronize the canonical gateway protobuf schema; --check rejects drift."""
|
|
import argparse
|
|
from pathlib import Path
|
|
parser=argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--check',action='store_true')
|
|
parser.add_argument('--server',type=Path,default=Path(__file__).resolve().parents[2]/'VNOX-Server/protocol/lnex.proto')
|
|
args=parser.parse_args()
|
|
target=Path(__file__).resolve().parents[1]/'protocol/lnex.proto'
|
|
source=args.server.read_bytes()
|
|
if args.check:
|
|
if target.read_bytes()!=source: parser.exit(1,'Client protocol differs from the authoritative gateway schema. Run scripts/sync-protocol.py.\n')
|
|
else: target.write_bytes(source)
|
|
print('LNEx protobuf schema matches the gateway')
|