diff options
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py index bc4989e..8c2d6c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,6 +18,7 @@ # import os import sys +import subprocess sys.path.insert(0, os.path.abspath('.')) @@ -346,3 +347,22 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None} + + +# Automate building apidoc when building with readthedocs +# https://github.com/rtfd/readthedocs.org/issues/1139 +def run_apidoc(_): + module = 'pymemcache' + cur_dir = os.path.abspath(os.path.dirname(__file__)) + output_path = os.path.join(cur_dir, 'docs', 'apidoc') + cmd_path = 'sphinx-apidoc' + if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv + # If we are, assemble the path manually + cmd_path = os.path.abspath(os.path.join(sys.prefix, + 'bin', 'sphinx-apidoc')) + subprocess.check_call([cmd_path, '-e', '-o', + output_path, module, '--force']) + + +def setup(app): + app.connect('builder-inited', run_apidoc) |