Catch another IOError in get_version()

This commit is contained in:
Norman Jäckel 2012-10-31 14:38:06 +01:00
parent c13f4ba52d
commit ac25e02e2d

View File

@ -31,11 +31,10 @@ def get_version(version=None):
sub = mapping[version[3]] + str(version[4])
try:
git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip()
except IOError:
git_commit_id = 'unknown'
else:
import os
git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip()
except IOError:
git_commit_id = 'unknown'
sub = '%s commit %s' % (sub, git_commit_id)
else:
sub = ''