Merge pull request #597 from cjmayo/nogit

Fix installation from source without git installed
This commit is contained in:
Chris Mayo 2021-12-16 19:26:57 +00:00 committed by GitHub
commit 2329d2bb11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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: