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 889f77343c
commit 3ce737335e
3 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,7 @@ Bugs fixed
* The default highlight language is now ``default``. This means that source code
is highlighted as Python 3 (which is mostly a superset of Python 2) if possible.
To get the old behavior back, add ``highlight_language = "python"`` to conf.py.
* #2329: Refresh environment forcely if source directory has changed.
Documentation
-------------

View File

@ -236,7 +236,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