Skip to content

Commit 1cf86c4

Browse files
Add smv_postbuild_command config option
1 parent e61ff44 commit 1cf86c4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/configuration.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ Here are some examples:
8181
8282
git for-each-ref --format "%(refname)"
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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults):
9494
)
9595
current_config.add("smv_prefer_remote_refs", False, "html", bool)
9696
current_config.add("smv_prebuild_command", "", "html", str)
97+
current_config.add("smv_postbuild_command", "", "html", str)
9798
current_config.pre_init_values()
9899
current_config.init_values()
99100
except Exception as err:
@@ -387,4 +388,13 @@ def main(argv=None):
387388
)
388389
subprocess.check_call(cmd, cwd=current_cwd, env=env)
389390

391+
if config.smv_postbuild_command != "":
392+
logger.debug(
393+
"Running postbuild command: %r",
394+
config.smv_postbuild_command,
395+
)
396+
subprocess.check_call(
397+
config.smv_postbuild_command, cwd=current_cwd, shell=True
398+
)
399+
390400
return 0

0 commit comments

Comments
 (0)