From 9cd2baba183a1b7a1ef03a01dc529c06a7d26cb4 Mon Sep 17 00:00:00 2001
From: Lukas Platz <lukas@lplatz.de>
Date: Mon, 3 May 2021 18:16:20 +0200
Subject: [PATCH] unbreak setup without git in path

If there is no `git` executable in the path of the installing shell,
the setup will fail because the `setup.py` `write_version` function will
raise a `FileNotFoundError` exception.
---
 setup.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index 84fc04372..750c81324 100644
--- a/setup.py
+++ b/setup.py
@@ -20,9 +20,13 @@ from setuptools import find_packages, setup
 
 def write_version():
     import subprocess
-    p = subprocess.Popen(["git", "describe", "--dirty", "--tags", "--always"],
-                         stdout=subprocess.PIPE)
-    res = p.communicate()[0].strip().decode('utf-8')
+    try:
+        p = subprocess.Popen(["git", "describe", "--dirty", "--tags", "--always"],
+                             stdout=subprocess.PIPE)
+        res = p.communicate()[0].strip().decode('utf-8')
+    except FileNotFoundError:
+        print("Could not determine version string from git history")
+        res = "unknown"
     with open("nifty7/git_version.py", "w") as file:
         file.write('gitversion = "{}"\n'.format(res))
 
-- 
GitLab