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]) sub = mapping[version[3]] + str(version[4])
try: try:
git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip() git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip()
except IOError:
git_commit_id = 'unknown'
else:
import os import os
git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip() 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) sub = '%s commit %s' % (sub, git_commit_id)
else: else:
sub = '' sub = ''