From ffb2b82dfb57b02a6eeb39f622586d17208ea88e Mon Sep 17 00:00:00 2001 From: Matej Matuska Date: Tue, 10 Sep 2024 17:39:33 +0200 Subject: [PATCH] docs: Add make rule to prepare venv similar to RTD build environment --- docs/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index 282c97a98b..7776471da8 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -12,10 +12,19 @@ help: livehtml: @$(SPHINXAUTOBUILD) --watch ../repos --watch ../commands "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(0) +# Prepare virtualenv similar to the environment used during build on Read The Docs and install required packages +env: + PY_VER=$$(sed -n -e 's/^\s*python:\s"\(.*\)"/\1/p' ../.readthedocs.yaml); \ + echo $$PY_VER; \ + rm -fr ./venv; \ + virtualenv venv --python=python$$PY_VER; \ + source venv/bin/activate; \ + pip install -r requirements-docs.txt; + # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile echo $@ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: all help Makefile +.PHONY: all help Makefile env