From c5c54201cd30463e6013365a5e5d3ac4e940af9d Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Sun, 1 Mar 2020 13:03:04 +0200 Subject: [PATCH] Documentation: ditaa: pick command invocation from env vars Currently the ditaa command is invoked directly and assumes that binfmt_misc support is enabled on the host to execute ditaa via jexec or jarwrapper. However that is not true in all cases (e.g. docker guests does not yet properly support binfmt_misc). This commit adds support for command invocation customization with two environment variables: SPHINX_DITAA_CMD to specify the executable and SPHINX_DITAA_ARG to specify a list of parameters. Signed-off-by: Octavian Purdila --- Documentation/sphinx/ditaa.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/sphinx/ditaa.py b/Documentation/sphinx/ditaa.py index 20b4a38ffefa1a..6921a7b02f028e 100644 --- a/Documentation/sphinx/ditaa.py +++ b/Documentation/sphinx/ditaa.py @@ -202,7 +202,18 @@ def setup(app): #latex=(latex_visit_ditaa, None), ) app.add_directive('ditaa', Ditaa) - app.add_config_value('ditaa', 'ditaa', 'html') - app.add_config_value('ditaa_args', [], 'html') + + try: + ditaa_cmd = os.environ['SPHINX_DITAA_CMD'] + except: + ditaa_cmd = 'ditaa' + + try: + ditaa_arg = os.environ['SPHINX_DITAA_ARG'].split(':') + except: + ditaa_arg = [] + + app.add_config_value('ditaa', ditaa_cmd , 'html') + app.add_config_value('ditaa_args', ditaa_arg, 'html') app.add_config_value('ditaa_log_enable', True, 'html') app.connect('doctree-read', on_doctree_resolved)