INNER CODE UNIT · Python

read_version

wolfSSL/wolfBoot · tools/sbom/sbom-driver.py:87

def read_version(version_file, version_macro):
    """Read a version string from a header, e.g. LIBWOLFBOOT_VERSION_STRING."""
    if not version_file or not os.path.isfile(version_file):
        return ""
    pat = re.compile(re.escape(version_macro) + r'\s*"([^"]*)"')
    with open(version_file, encoding="utf-8", errors="replace") as f:
        for line in f:
            m = pat.search(line)
            if m:
                return m.group(1)
    return ""


def find_gen_sbom(explicit):
    """Locate gen-sbom: explicit arg, a sibling vendored copy, then WOLFSSL_DIR."""
    if explicit:
        return explicit
    sibling = os.path.join(SCRIPT_DIR, "gen-sbom")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…