Skip to content

Commit

Permalink
add handling of additional prerequisite packages
Browse files Browse the repository at this point in the history
See canonical#197
If projects include additional Python packages in custom_conf.py,
those must be installed before running the build_requirements.py
script.
This change makes it possible to just specify such packages in
the ADDPREREQS variable.

Signed-off-by: Ruth Fuchss <[email protected]>
  • Loading branch information
ru-fu committed Jun 4, 2024
1 parent 1ff279d commit 9257889
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile.sp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PA11Y = $(SPHINXDIR)/node_modules/pa11y/bin/pa11y.js --config $(SPHINXDI
VENV = $(VENVDIR)/bin/activate
TARGET = *
ALLFILES = *.rst **/*.rst
ADDPREREQS ?=
.PHONY: sp-full-help sp-woke-install sp-pa11y-install sp-install sp-run sp-html \
sp-epub sp-serve sp-clean sp-clean-doc sp-spelling sp-spellcheck sp-linkcheck sp-woke \
Expand All @@ -26,9 +27,13 @@ sp-full-help: $(VENVDIR)
# Shouldn't assume that venv is available on Ubuntu by default; discussion here:
# https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1290847
$(SPHINXDIR)/requirements.txt:
python3 $(SPHINXDIR)/build_requirements.py
python3 -c "import venv" || \
@python3 -c "import venv" || \
(echo "You must install python3-venv before you can build the documentation."; exit 1)
python3 -m venv $(VENVDIR)
@if [ ! -z "$(ADDPREREQS)" ]; then \
. $(VENV); pip install --require-virtualenv $(ADDPREREQS); \
fi
. $(VENV); python3 $(SPHINXDIR)/build_requirements.py
# If requirements are updated, venv should be rebuilt and timestamped.
$(VENVDIR): $(SPHINXDIR)/requirements.txt
Expand Down

0 comments on commit 9257889

Please sign in to comment.