This commit is contained in:
Georg Brandl 2013-01-04 11:17:57 +01:00
commit 367614d23a
4 changed files with 9 additions and 5 deletions

View File

@ -66,6 +66,8 @@ Release 1.2 (in development)
* #1041: Fix cpp domain parser fails to parse a const type with a modifier.
* #958: Do not preserve ``environment.pickle`` after a failed build.
* PR#88: Added the "Sphinx Developer's Guide" (:file:`doc/devguide.rst`)
which outlines the basic development process of the Sphinx project.

View File

@ -11,6 +11,7 @@
:license: BSD, see LICENSE for details.
"""
import os
import sys
import types
import posixpath
@ -203,6 +204,10 @@ class Sphinx(object):
else:
self.builder.build_update()
except Exception, err:
# delete the saved env to force a fresh build next time
envfile = path.join(self.doctreedir, ENV_PICKLE_FILENAME)
if path.isfile(envfile):
os.unlink(envfile)
self.emit('build-finished', err)
raise
else:

View File

@ -365,9 +365,7 @@ class BuildEnvironment:
del self.config.values
domains = self.domains
del self.domains
# first write to a temporary file, so that if dumping fails,
# the existing environment won't be overwritten
picklefile = open(filename + '.tmp', 'wb')
picklefile = open(filename, 'wb')
# remove potentially pickling-problematic values from config
for key, val in vars(self.config).items():
if key.startswith('_') or \
@ -379,7 +377,6 @@ class BuildEnvironment:
pickle.dump(self, picklefile, pickle.HIGHEST_PROTOCOL)
finally:
picklefile.close()
movefile(filename + '.tmp', filename)
# reset attributes
self.domains = domains
self.config.values = values

View File

@ -219,7 +219,7 @@ def test_i18n_literalblock_warning(app):
u"\n this is"
u"\n literal block\n"
u"\nMISSING LITERAL BLOCK:\n"
u"\n<SYSTEM MESSAGE: ")
u"\n<SYSTEM MESSAGE:")
assert result.startswith(expect)
warnings = warnfile.getvalue().replace(os.sep, '/')