From 1e7c865cbad2e94cb719fa2d48810885e61cc0b6 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 2 Jun 2015 11:04:20 -0700 Subject: [PATCH] Implement @takluyver's magic RTD executor :skull: --- docs/autogen_config.py | 5 ++++- docs/source/conf.py | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/autogen_config.py b/docs/autogen_config.py index f84d99113..da5105a55 100644 --- a/docs/autogen_config.py +++ b/docs/autogen_config.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os.path from qtconsole.qtconsoleapp import JupyterQtConsoleApp header = """\ @@ -34,6 +35,8 @@ enter:: """ -with open("source/config.rst", 'w') as f: +destination = os.path.join(os.path.dirname(__file__), 'source/config.rst') + +with open(destination, 'w') as f: f.write(header) f.write(JupyterQtConsoleApp().document_config_options()) diff --git a/docs/source/conf.py b/docs/source/conf.py index 15b3927fc..dd3589596 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,6 +22,13 @@ import shlex # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) +if os.environ.get('READTHEDOCS', ''): + + # Readthedocs doesn't run our Makefile, so we do this to force it to generate + # the config docs. + with open('../autogen_config.py') as f: + exec(compile(f.read(), '../autogen_config.py', 'exec'), {}) + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here.