summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Estelami <NEstelami@users.noreply.github.com>2023-04-27 21:15:57 -0400
committerGitHub <noreply@github.com>2023-04-27 21:15:57 -0400
commit1c0178b0e5311188d24986c2667c72b0ae0d184f (patch)
tree61ed20a555a02bc8f655063f557123872d348bfd
parent23929ec9373d28cb298daad4ad7cb468e09c0a46 (diff)
Fixed build error from missing .git directory. (#277)
* Fixed build error from missing .git directory * Improved git failsafe
-rw-r--r--ZAPD/genbuildinfo.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ZAPD/genbuildinfo.py b/ZAPD/genbuildinfo.py
index 91a567d..3317c42 100644
--- a/ZAPD/genbuildinfo.py
+++ b/ZAPD/genbuildinfo.py
@@ -10,7 +10,13 @@ parser.add_argument("--devel", action="store_true")
args = parser.parse_args()
with open("build/ZAPD/BuildInfo.cpp", "w+") as buildFile:
- label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8")
+ # Get commit hash from git
+ # If git fails due to a missing .git directory, a default label will be used instead.
+ try:
+ label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8")
+ except:
+ label = "GIT_NOT_FOUND"
+
now = datetime.now()
if args.devel:
label += " ~ Development version"