Skip to content

Commit

Permalink
Move extension from builder- to config-inited
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Jan 10, 2024
1 parent 2a4628f commit 8bf0ff9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions sphinx_apipages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def setup(app: sphinx.application.Sphinx):
"hidden_methods": app.config.apipages_hidden_methods,
}

# Connect builder
app.connect("builder-inited", builder_inited)
# Connect events
app.connect("config-inited", config_inited)

return {"version": __version__, "parallel_read_safe": False}

Expand All @@ -65,12 +65,8 @@ def setup(app: sphinx.application.Sphinx):
# via app.connect()
# in setup()
#
def builder_inited(app: sphinx.application.Sphinx):
r"""Emitted when the builder object has been created.
It is available as ``app.builder``.
"""
def config_inited(app: sphinx.application.Sphinx, config):
r"""Emitted when the config object has been initialized."""
# Read config values
src_dir = app.config.apipages_src_dir
dst_dir = app.config.apipages_dst_dir
Expand All @@ -89,4 +85,3 @@ def builder_inited(app: sphinx.application.Sphinx):
or not filecmp.cmp(src_file, dst_file) # changed file
):
shutil.copyfile(src_file, dst_file)
app.config.autosummary_generate.append(dst_file)

0 comments on commit 8bf0ff9

Please sign in to comment.