diff options
author | Nicholas Charriere <nicholas@pinterest.com> | 2016-08-03 14:12:14 -0700 |
---|---|---|
committer | Nicholas Charriere <nicholas@pinterest.com> | 2016-08-03 14:12:14 -0700 |
commit | a0384415d0bf10c6251f3b36d9375ac1810d32bb (patch) | |
tree | b27b19527748090b4e2a62f1c68766efeae43ed1 /docs/conf.py | |
parent | ea7b7be603f08ee4585d2594d86be0a9b79c2041 (diff) | |
download | pymemcache-docs.tar.gz |
Automate doc buildingdocs
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) |