check_asn1.py 402 Bytes
Newer Older
from asn1tools import parse_files, ParseError
import sys
from glob import glob
from pathlib import Path


schemaFileGlob = glob("*.asn1")
if (len(schemaFileGlob) != 1):
    sys.exit("Found {0} XSD files, 1 expected".format(len(schemaFileGlob)))

schemaFile = schemaFileGlob[0]
try:
    parse_files(schemaFile)
except ParseError as ex:
    sys.exit("ASN1 parser error: " + ex)

print ("ASN1 schema OK")