Skip to content

Commit 8d71899

Browse files
committed
scripts: gen-doc: enforce python virtual environment
System tools for sphinx etc tend to be behind the versions available via pip. Prefer the pip version and automatically enable the Python virtual environment when starting the script. Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
1 parent 895be79 commit 8d71899

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

scripts/gen-doc.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,25 @@
66
# According to instructions:
77
# https://thesofproject.github.io/latest/howtos/process/docbuild.html
88

9-
# fail immediately on any errors
10-
set -e
9+
# this needs to run from the Zephyr python virtual environment
10+
# so that the python packages are available (and more up to date than
11+
# the system packages).
12+
13+
# check if Zephyr environment is set up
14+
if [ ! -z "$ZEPHYR_BASE" ]; then
15+
VENV_DIR="$ZEPHYR_BASE/.venv"
16+
echo "Using Zephyr environment at $ZEPHYR_BASE"
17+
elif [ ! -z "$SOF_WORKSPACE" ]; then
18+
VENV_DIR="$SOF_WORKSPACE/zephyr/.venv"
19+
echo "Using SOF/Zephyr environment at $SOF_WORKSPACE"
20+
else
21+
# fallback to the zephyr default from the getting started guide
22+
VENV_DIR="$HOME/zephyrproject/.venv"
23+
echo "Using default Zephyr environment at $VENV_DIR"
24+
fi
25+
26+
# start the virtual environment
27+
source ${VENV_DIR}/bin/activate
1128

1229
function print_usage()
1330
{
@@ -133,3 +150,6 @@ then
133150
cd "$DOCS_REPO"
134151
make publish
135152
fi
153+
154+
# cleanup
155+
deactivate

0 commit comments

Comments
 (0)