Skip to content

Commit

Permalink
tools: raise exception if git not available when creating release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
eine committed Apr 9, 2020
1 parent 4492326 commit 9bd5246
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tools/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ def _get_date(commit):
"""
Get date
"""
date_str = (
check_output([which("git"), "log", "-1", "--format=%ci", commit])
.decode()
.strip()
)
git = which("git")
if git is None:
raise BaseException("'git' is required!")
date_str = check_output([git, "log", "-1", "--format=%ci", commit]).decode().strip()
date_str = " ".join(date_str.split(" ")[0:2])
return datetime.datetime.strptime(date_str, "%Y-%m-%d %H:%M:%S")

0 comments on commit 9bd5246

Please sign in to comment.