Skip to content

Commit

Permalink
fixup! docs: Add make rule to prepare venv similar to RTD build envir…
Browse files Browse the repository at this point in the history
…onment
  • Loading branch information
matejmatuska committed Sep 11, 2024
1 parent c68f4d3 commit fae4837
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ BUILDDIR = build
all: clean html

help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@source venv/bin/activate && \
$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
livehtml:
@$(SPHINXAUTOBUILD) --watch ../repos --watch ../commands "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(0)
@source venv/bin/activate && \
$(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; \
@PY_VER=$$(sed -n -e 's/^\s*python:\s"\(.*\)"/\1/p' ../.readthedocs.yaml); \
rm -fr ./venv; \
virtualenv venv --python=python$$PY_VER; \
source venv/bin/activate; \
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)
@source venv/bin/activate && \
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: all help Makefile env

0 comments on commit fae4837

Please sign in to comment.