Fix installation from source without git installed

This commit is contained in:
Chris Mayo 2021-12-15 19:40:27 +00:00
parent 92f189579e
commit 9ed2d8703b

View file

@ -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: