Skip to content

Commit 46e20cc

Browse files
Add smv_postbuild_command config option
1 parent 5d85ba7 commit 46e20cc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/configuration.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ Here are some examples:
8181
8282
git for-each-ref --format "%(refname)" | sed 's/^refs\///g'
8383
84-
Prebuild command
84+
Pre and post-build command
8585
================
8686

87-
In some cases it may be necessary to run a command in the checked out directory before building with sphinx. For example if you are using ``sphinx-apidoc`` to generate the autodoc api source files.
87+
In some cases it may be necessary to run a command in the checked out directory before or after building with sphinx. For example if you are using ``sphinx-apidoc`` to generate the autodoc api source files.
88+
89+
The options ``smv_prebuild_command`` and ``smv_postbuild_command`` are provided.
8890

8991
For example:
9092

sphinx_multiversion/main.py

+10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults):
6868
)
6969
current_config.add("smv_prefer_remote_refs", False, "html", bool)
7070
current_config.add("smv_prebuild_command", "", "html", str)
71+
current_config.add("smv_postbuild_command", "", "html", str)
7172
current_config.pre_init_values()
7273
current_config.init_values()
7374
except Exception as err:
@@ -361,4 +362,13 @@ def main(argv=None):
361362
)
362363
subprocess.check_call(cmd, cwd=current_cwd, env=env)
363364

365+
if config.smv_postbuild_command != "":
366+
logger.debug(
367+
"Running postbuild command: %r",
368+
config.smv_postbuild_command,
369+
)
370+
subprocess.check_call(
371+
config.smv_postbuild_command, cwd=current_cwd, shell=True
372+
)
373+
364374
return 0

0 commit comments

Comments
 (0)