Always close .buildinfo file after reading.

This commit is contained in:
Georg Brandl 2011-09-22 14:28:31 +02:00
parent 3d4b8830a0
commit f250397f77

View File

@ -159,6 +159,7 @@ class StandaloneHTMLBuilder(Builder):
old_config_hash = old_tags_hash = '' old_config_hash = old_tags_hash = ''
try: try:
fp = open(path.join(self.outdir, '.buildinfo')) fp = open(path.join(self.outdir, '.buildinfo'))
try:
version = fp.readline() version = fp.readline()
if version.rstrip() != '# Sphinx build info version 1': if version.rstrip() != '# Sphinx build info version 1':
raise ValueError raise ValueError
@ -169,6 +170,7 @@ class StandaloneHTMLBuilder(Builder):
tag, old_tags_hash = fp.readline().strip().split(': ') tag, old_tags_hash = fp.readline().strip().split(': ')
if tag != 'tags': if tag != 'tags':
raise ValueError raise ValueError
finally:
fp.close() fp.close()
except ValueError: except ValueError:
self.warn('unsupported build info format in %r, building all' % self.warn('unsupported build info format in %r, building all' %