Jon Waltman avatar Jon Waltman committed d42e859

Closes #958: Do not preserve ``environment.pickle`` after a failed build.

Comments (0)

Files changed (3)

 * #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.


     :license: BSD, see LICENSE for details.
+import os
 import sys
 import types
 import posixpath
         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)


         del self.config.values
         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 \
             pickle.dump(self, picklefile, pickle.HIGHEST_PROTOCOL)
-        movefile(filename + '.tmp', filename)
         # reset attributes = domains
         self.config.values = values
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.