diff --git a/docs/conf.py b/docs/conf.py index b1be029625..ad1f755911 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os - +import shutil import sys sys.path.insert(0, os.path.abspath('..')) @@ -250,6 +250,11 @@ _docs_to_remove = [] +def config_inited(app, config): + if on_rtd: + shutil.rmtree(os.path.join(app.doctreedir, 'environment.pickle')) + + def builder_inited(app): """Run during Sphinx `builder-inited` phase. @@ -261,7 +266,6 @@ def builder_inited(app): # Remove pages when builder matches any referenced in exclude_from_builder if exclude_from_builder.get(app.builder.name): _docs_to_remove.extend(exclude_from_builder[app.builder.name]) - extensions[-4:] = [] print('reading _docs_to_remove') print(_docs_to_remove) @@ -328,6 +332,7 @@ def setup(app): app.add_stylesheet('custom.css') # Run extra steps to remove module docs when running with a non-html builder + app.connect('config-inited', config_inited) app.connect('builder-inited', builder_inited) app.connect('env-get-outdated', env_get_outdated) app.connect('doctree-read', doctree_read)