Fix #2329: Refresh environment forcely if source directory has changed

This commit is contained in:
Takeshi KOMIYA 2016-02-20 17:11:33 +09:00
parent 6101cb4ab6
commit 39bef55fd5
3 changed files with 5 additions and 2 deletions

View File

@ -21,6 +21,7 @@ Bugs fixed
* #2290: Fix ``sphinx.ext.mathbase`` use of amsfonts may break user choice of math fonts
* #2324: Print a hint how to increase the recursion limit when it is hit.
* #1565: Revert new warning; the new warning will be triggered from version 1.4 on.
* #2329: Refresh environment forcely if source directory has changed.
Release 1.3.5 (released Jan 24, 2016)

View File

@ -221,7 +221,7 @@ class Sphinx(object):
try:
self.info(bold('loading pickled environment... '), nonl=True)
self.env = BuildEnvironment.frompickle(
self.config, path.join(self.doctreedir, ENV_PICKLE_FILENAME))
self.srcdir, self.config, path.join(self.doctreedir, ENV_PICKLE_FILENAME))
self.env.domains = {}
for domain in self.domains.keys():
# this can raise if the data version doesn't fit

View File

@ -101,7 +101,7 @@ class BuildEnvironment:
# --------- ENVIRONMENT PERSISTENCE ----------------------------------------
@staticmethod
def frompickle(config, filename):
def frompickle(srcdir, config, filename):
picklefile = open(filename, 'rb')
try:
env = pickle.load(picklefile)
@ -109,6 +109,8 @@ class BuildEnvironment:
picklefile.close()
if env.version != ENV_VERSION:
raise IOError('build environment version not current')
if env.srcdir != srcdir:
raise IOError('source directory has changed')
env.config.values = config.values
return env