Skip to content

Commit 1c852dd

Browse files
Marti BolivarMaureenHelm
authored andcommitted
doc: conf.py: make sure west is importable from Python
We need this to be able to pull in its API documentation. This will need modifications when multi-repo support is available, in order to get the imports from the independent West repo, but for now just use the copy in Zephyr. Signed-off-by: Marti Bolivar <[email protected]>
1 parent e802d8d commit 1c852dd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

doc/conf.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@
1515
import sys
1616
import os
1717

18+
if "ZEPHYR_BASE" not in os.environ:
19+
sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n")
20+
exit(1)
21+
ZEPHYR_BASE = os.environ["ZEPHYR_BASE"]
22+
1823
# Add the 'extensions' directory to sys.path, to enable finding Sphinx
1924
# extensions within.
2025
sys.path.insert(0, os.path.join(os.path.abspath('.'), 'extensions'))
26+
# Also add west, to be able to pull in its API docs.
27+
sys.path.append(os.path.abspath(os.path.join(ZEPHYR_BASE, 'scripts', 'meta')))
2128

2229
# -- General configuration ------------------------------------------------
2330

@@ -52,11 +59,6 @@
5259
copyright = u'2015-2017 Zephyr Project members and individual contributors.'
5360
author = u'many'
5461

55-
if "ZEPHYR_BASE" not in os.environ:
56-
sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n")
57-
exit(1)
58-
ZEPHYR_BASE = os.environ["ZEPHYR_BASE"]
59-
6062
# The following code tries to extract the information by reading the Makefile,
6163
# when Sphinx is run directly (e.g. by Read the Docs).
6264
try:

0 commit comments

Comments
 (0)