From 9ed2d8703b00a9b3d8d068b383abc558e179262e Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Wed, 15 Dec 2021 19:40:27 +0000 Subject: [PATCH] Fix installation from source without git installed --- setup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f755ff4e..287895fa 100755 --- a/setup.py +++ b/setup.py @@ -89,10 +89,14 @@ def cnormpath(path): def get_release_date(for_sdist=False): """Return release date as a string from the most recent commit.""" release_date = "unknown" - # need git >= 2.25.0 for %cs - cp = subprocess.run(["git", "log", "-n 1", "HEAD", "--format=%cI"], - stdout=subprocess.PIPE, universal_newlines=True) - if cp.stdout: + cp = None + try: + # need git >= 2.25.0 for %cs + cp = subprocess.run(["git", "log", "-n 1", "HEAD", "--format=%cI"], + stdout=subprocess.PIPE, universal_newlines=True) + except FileNotFoundError: + pass + if cp and cp.stdout: release_date = cp.stdout.split("T")[0] elif not for_sdist: try: