Commit 63101d24 authored by Luke Mewburn's avatar Luke Mewburn Committed by Luke Mewburn
Browse files

asn_process: run as script. support LOGLEVEL

Allow asn_process.py to be run as standalone python script.
Support overriding the logger level with LOGLEVEL from the environment.
parent 1e3df69b
Loading
Loading
Loading
Loading
+x+8
Changes for testing/asn/asn_process.py: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env python3

import json
import logging
import os
import shutil
import subprocess
import sys
@@ -10,6 +13,7 @@ from pathlib import Path
# but it isn't yet included in the distribution (still at 0.7.11 , Jul 2025)
# When this gets updated we may be able to use only pycrate, and drop the use of asn1c
import pycrate_asn1c.asnproc
import pycrate_asn1c.utils

logger = logging.getLogger(__name__)

@@ -181,6 +185,10 @@ def processResults(results, stageName):


def main():
    loglevel = os.environ.get("LOGLEVEL", "WARNING").upper()
    logging.basicConfig(level=loglevel)
    pycrate_asn1c.utils.logger.setLevel(loglevel)

    logger.info("Searching for ASN1C")
    global asn1c_path
    asn1c_path = shutil.which("asn1c")