Unity/auto/extract_version.py
Andrew McNulty 44bc9e6dbe Update Meson build system
The following features from the CMake build have been implemented:
 * Library version retrieved from unity.h.
 * Extension support.
 * Library, header, and package configuration file installation.

This commit is entirely based on existing work by Owen Torres.
2023-02-13 17:22:52 +01:00

16 lines
303 B
Python
Executable File

#!/usr/bin/env python3
import re
import sys
ver_re = re.compile(r"^#define\s+UNITY_VERSION_(?:MAJOR|MINOR|BUILD)\s+(\d+)$")
version = []
with open(sys.argv[1], "r") as f:
for line in f:
m = ver_re.match(line)
if m:
version.append(m.group(1))
print(".".join(version))