1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00
Files
Unity/auto/extract_version.py
Fredrik Ellertsen f1d953a651 Fix shebang placement
671f8d2 introduced a license header to auto/extract_version.py before the
shebang, causing builds to fail like this:
  ../subprojects/unity/meson.build:7:0: ERROR: Failed running '/path/to/extract_version.py', binary or interpreter not executable.
2024-03-20 12:47:02 +01:00

23 lines
622 B
Python
Executable File

#!/usr/bin/env python3
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
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))