From: Guus Sliepen Date: Fri, 1 Apr 2022 10:46:11 +0000 (+0200) Subject: Make sure version.py runs succesfully even if git is not installed. X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=dff94d1df4228386ea9f523b1bfc37590ca31fd8;p=tinc Make sure version.py runs succesfully even if git is not installed. --- diff --git a/version.py b/version.py index e9419a03..b4fb38af 100755 --- a/version.py +++ b/version.py @@ -21,10 +21,16 @@ cmd = [ if "short" in argv: cmd.append("--abbrev=0") -result = subp.run(cmd, stdout=subp.PIPE, encoding="utf-8") -version = result.stdout +version = None -if result.returncode or not version: +try: + result = subp.run(cmd, stdout=subp.PIPE, encoding="utf-8") + if not result.returncode: + version = result.stdout +except FileNotFoundError: + pass + +if not version: try: with open(path.join(source_root, "VERSION"), "r") as f: version = f.read().strip()