diff --git a/doc/conf.py b/doc/conf.py index e71210c804a..819b5684bb8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -15,9 +15,16 @@ import sys import os +if "ZEPHYR_BASE" not in os.environ: + sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n") + exit(1) +ZEPHYR_BASE = os.environ["ZEPHYR_BASE"] + # Add the 'extensions' directory to sys.path, to enable finding Sphinx # extensions within. sys.path.insert(0, os.path.join(os.path.abspath('.'), 'extensions')) +# Also add west, to be able to pull in its API docs. +sys.path.append(os.path.abspath(os.path.join(ZEPHYR_BASE, 'scripts', 'meta'))) # -- General configuration ------------------------------------------------ @@ -52,11 +59,6 @@ project = u'Zephyr Project' copyright = u'2015-2017 Zephyr Project members and individual contributors.' author = u'many' -if "ZEPHYR_BASE" not in os.environ: - sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n") - exit(1) -ZEPHYR_BASE = os.environ["ZEPHYR_BASE"] - # The following code tries to extract the information by reading the Makefile, # when Sphinx is run directly (e.g. by Read the Docs). try: