From 5728f70c0b1f95ff4f09a956dddcdc8c015b5c69 Mon Sep 17 00:00:00 2001 From: TheBakedPotato <11617336+TheBakedPotato@users.noreply.github.com> Date: Thu, 22 Jan 2026 20:01:53 -0500 Subject: [PATCH] (#333): Pulls the latest committed tag to insert into the compiler build flag for FIRWARE_VERSION --- Firmware/GPAD_API/pre_extra_script.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Firmware/GPAD_API/pre_extra_script.py b/Firmware/GPAD_API/pre_extra_script.py index e83baff2..5662ac60 100644 --- a/Firmware/GPAD_API/pre_extra_script.py +++ b/Firmware/GPAD_API/pre_extra_script.py @@ -1,9 +1,20 @@ Import("env") +try: + import git +except ImportError: + env.Execute("$PYTHONEXE -m pip install GitPython") + +repo = git.Repo('../../') +tags = sorted(repo.tags, key=lambda t: t.commit.committed_datetime) +latest_tag = "unknown" +if len(tags) > 0: + latest_tag = [-1] + cpp_defines = [ ("COMPANY_NAME", "PubInv "), # For the Broker ID for MQTT ("PROG_NAME", "GPAD_API "), # This program - ("FIRMWARE_VERSION", "0.46 "), # Initial Menu implementation + ("FIRMWARE_VERSION", f"{latest_tag} "), ("MODEL_NAME", "KRAKE_"), ("LICENSE", "GNU Affero General Public License, version 3 "), ("ORIGIN", "US"),