From 76b2d481e00c1dd1f326ed685437ede08b1f3c85 Mon Sep 17 00:00:00 2001 From: Martyn Gigg Date: Wed, 11 Jun 2014 21:39:48 +0100 Subject: [PATCH] Tidy up of runsphinx template. Refs #9639 --- Code/Mantid/docs/runsphinx.py.in | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Code/Mantid/docs/runsphinx.py.in b/Code/Mantid/docs/runsphinx.py.in index 28f117aede4d..5f8ea3ce9f98 100644 --- a/Code/Mantid/docs/runsphinx.py.in +++ b/Code/Mantid/docs/runsphinx.py.in @@ -1,23 +1,29 @@ """We need to run Sphinx inside MantidPlot to document the internal - module. This script calls the sphinx entry point with the necessary + module. This script calls the sphinx entry point with the necessary arguments """ import os import sys -# set environment -screenshots_dir = "@SCREENSHOTS_DIR@" -if screenshots_dir != "": - os.environ["SCREENSHOTS_DIR"] = screenshots_dir +def main(): + # Update environment with screenshots path + screenshots_dir = "@SCREENSHOTS_DIR@" + if screenshots_dir != "": + os.environ["SCREENSHOTS_DIR"] = screenshots_dir -builder = "@BUILDER@" -src_dir = "@CMAKE_CURRENT_SOURCE_DIR@/source" -sphinx_build_dir = "@SPHINX_BUILD_DIR@" -output_dir = os.path.join(sphinx_build_dir, builder) -doctree_dir = os.path.join(sphinx_build_dir, "doctrees") + builder = "@BUILDER@" + src_dir = "@CMAKE_CURRENT_SOURCE_DIR@/source" + sphinx_build_dir = "@SPHINX_BUILD_DIR@" + output_dir = os.path.join(sphinx_build_dir, builder) + doctree_dir = os.path.join(sphinx_build_dir, "doctrees") -if __name__ == "__main__": - from sphinx import main + import sphinx argv = [sys.executable, "-b", builder, "-d", doctree_dir, src_dir, output_dir] - sys.exit(main(argv)) + # run + sys.exit(sphinx.main(argv)) + +################################################################################## + +if __name__ == "__main__": + main()