diff --git a/CHANGES b/CHANGES index f3d83fdd9..44b57d17f 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/sphinx/application.py b/sphinx/application.py index 07c3024dd..c1da6904b 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -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 diff --git a/sphinx/environment.py b/sphinx/environment.py index a039ba071..ebe167dbd 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -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