From 392dfc921dd714373225f84f4f64b85855a3510e Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Thu, 2 May 2024 22:46:50 +0100 Subject: [PATCH] fix: remove python dependency for revision build script --- src/Makefile | 2 +- src/build-scripts/hydrafw-revision | 14 ++++++++++++++ src/build-scripts/hydrafw-revision.py | 13 ------------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100755 src/build-scripts/hydrafw-revision delete mode 100644 src/build-scripts/hydrafw-revision.py diff --git a/src/Makefile b/src/Makefile index f8bc2cee..50e4a519 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,7 @@ export STM32F4XX ?= 1 # Set to 1 HYDRAFW_NFC to include HydraNFC extension support export HYDRAFW_NFC ?= 1 export HYDRAFW_DEBUG ?= 0 -export FW_REVISION := $(shell $(PYTHON) build-scripts/hydrafw-revision.py) +export FW_REVISION := $(shell build-scripts/hydrafw-revision) HYDRAFW_OPTS = diff --git a/src/build-scripts/hydrafw-revision b/src/build-scripts/hydrafw-revision new file mode 100755 index 00000000..8a1f56ca --- /dev/null +++ b/src/build-scripts/hydrafw-revision @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the version description from git +version=$(git describe --tags --always --dirty --long) + +# Use regex to match version pattern v(x.x) +if [[ $version =~ v([0-9]+\.[0-9]+).* ]] +then + # If match found, print the version + echo ${BASH_REMATCH[1]} +else + # Print 0.0 if no match is found + echo "0.0" +fi diff --git a/src/build-scripts/hydrafw-revision.py b/src/build-scripts/hydrafw-revision.py deleted file mode 100644 index 1c70982e..00000000 --- a/src/build-scripts/hydrafw-revision.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -from git import * -import re - -r = re.compile("v(\d+\.\d+).*") - -git=Repo(search_parent_directories=True).git -version = git.describe(tags=True,always=True,dirty=True,long=True) -if r.search(version): - print(r.search(version).group(1)) -else: - print("0.0")