Merge pull request #770 from SchrodingersGat/missing-git

Catch an error if git cannot be found
This commit is contained in:
Oliver 2020-05-01 17:08:42 +10:00 committed by GitHub
commit acea0d6e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,12 +27,17 @@ def inventreeDjangoVersion():
def inventreeCommitHash():
""" Returns the git commit hash for the running codebase """
return str(subprocess.check_output('git rev-parse --short HEAD'.split()), 'utf-8').strip()
try:
return str(subprocess.check_output('git rev-parse --short HEAD'.split()), 'utf-8').strip()
except FileNotFoundError:
return None
def inventreeCommitDate():
""" Returns the git commit date for the running codebase """
d = str(subprocess.check_output('git show -s --format=%ci'.split()), 'utf-8').strip()
return d.split(' ')[0]
try:
d = str(subprocess.check_output('git show -s --format=%ci'.split()), 'utf-8').strip()
return d.split(' ')[0]
except FileNotFoundError:
return None