From a6f3a48f8f3ba39a001b8b55afa5355fd5146abe Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 7 Jun 2021 20:38:52 +0000 Subject: [PATCH] Avoid git version always appearing as dirty --- genbindings.py | 6 ++++-- genbindings.sh | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/genbindings.py b/genbindings.py index 43956f43..35a3be01 100755 --- a/genbindings.py +++ b/genbindings.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import sys, re, subprocess +import os, sys, re, subprocess if len(sys.argv) < 7: print("USAGE: /path/to/lightning.h /path/to/bindings/output /path/to/bindings/ /path/to/bindings/output.c debug lang") @@ -33,7 +33,9 @@ else: consts = Consts(DEBUG, target=target) -local_git_version = subprocess.check_output(["git", "describe", '--tag', '--dirty']).decode("utf-8").strip() +local_git_version = os.getenv("LDK_GARBAGECOLLECTED_GIT_OVERRIDE") +if local_git_version is None: + local_git_version = subprocess.check_output(["git", "describe", '--tag', '--dirty']).decode("utf-8").strip() from bindingstypes import * diff --git a/genbindings.sh b/genbindings.sh index b06f9c40..cd549d79 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -18,6 +18,10 @@ fi set -e +if [ "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" = "" ]; then + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE=$(git describe --tag --dirty) +fi + cp "$1/lightning-c-bindings/include/lightning.h" ./ if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then # OSX sed is for some reason not compatible with GNU sed -- 2.39.5