From 4e87b5170aa027f71301556d5b60b3b12a7d40ed Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 24 Feb 2013 00:43:43 +0200 Subject: [PATCH] Allow Sphinx build docs with docstrings without installing module. --- docs/source/conf.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5c5c38d..830f1ad 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,12 +11,22 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import sys, os, glob # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +#sys.path.insert(0, os.path.abspath('../..')) + +# Support sphinx.ext.autodoc to extract docstrings from modules without installing +# complete package. +# The python modules depend on _core, so we must build entire package first though. +built_lib = glob.glob('../../build/lib.*/') +if not built_lib: + print "WARNING: To build complete documentation you must build package first" +else: + # lib dir has platform suffix + sys.path.insert(0, os.path.abspath(built_lib[0])) # -- General configuration -----------------------------------------------------