diff --git a/CHANGES b/CHANGES index d1ef85171..19461bfdd 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ Bugs fixed * #4096: C++, don't crash when using the wrong role type. Thanks to mitya57. * #4070, #4111: crashes when the warning message contains format strings (again) * #4108: Search word highlighting breaks SVG images +* #3692: Unable to build HTML if writing .buildinfo failed Testing -------- diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 90e4574cc..ead51a983 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -776,12 +776,15 @@ class StandaloneHTMLBuilder(Builder): def write_buildinfo(self): # type: () -> None # write build info file - with open(path.join(self.outdir, '.buildinfo'), 'w') as fp: - fp.write('# Sphinx build info version 1\n' - '# This file hashes the configuration used when building' - ' these files. When it is not found, a full rebuild will' - ' be done.\nconfig: %s\ntags: %s\n' % - (self.config_hash, self.tags_hash)) + try: + with open(path.join(self.outdir, '.buildinfo'), 'w') as fp: + fp.write('# Sphinx build info version 1\n' + '# This file hashes the configuration used when building' + ' these files. When it is not found, a full rebuild will' + ' be done.\nconfig: %s\ntags: %s\n' % + (self.config_hash, self.tags_hash)) + except IOError as exc: + logger.warning('Failed to write build info file: %r', exc) def cleanup(self): # type: () -> None