mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2329: Refresh environment forcely if source directory has changed
This commit is contained in:
parent
889f77343c
commit
3ce737335e
1
CHANGES
1
CHANGES
@ -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
|
||||
-------------
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user