Skip to content

Commit

Permalink
Fix sphinx-contrib#8: Incremental building not working
Browse files Browse the repository at this point in the history
  • Loading branch information
kujiu authored and terencehonles committed Aug 20, 2020
1 parent addec8d commit f1184cd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions sphinxcontrib/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,15 @@ def download_images(app, env):
.format(src, dst))


def configure_backend(app):
global DEFAULT_CONFIG
def check_config(app, config):
'''Ensure all config values are defined'''

config = copy.deepcopy(DEFAULT_CONFIG)
config.update(app.config.images_config)
app.config.images_config = config
merged = copy.deepcopy(DEFAULT_CONFIG)
merged.update(config.images_config)
config.images_config = merged

def configure_backend(app):
config = app.config.images_config
ensuredir(os.path.join(app.env.srcdir, config['cache_path']))

# html builder
Expand Down Expand Up @@ -343,9 +345,9 @@ def inner_wrapper(writer, node):
app.env.remote_images = {}

def setup(app):
global DEFAULT_CONFIG
app.require_sphinx('1.0')
app.add_config_value('images_config', DEFAULT_CONFIG, 'env')
app.add_config_value('images_config', {}, 'env')
app.connect('config-inited', check_config)
app.connect('builder-inited', configure_backend)
app.connect('env-updated', download_images)
app.connect('env-updated', install_backend_static_files)
Expand Down

0 comments on commit f1184cd

Please sign in to comment.