Skip to content

Commit

Permalink
fixup! docs: Add make rule to prepare venv similar to RTD build env
Browse files Browse the repository at this point in the history
  • Loading branch information
matejmatuska committed Sep 11, 2024
1 parent 493b1d2 commit a6d75a7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@ BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@source venv/bin/activate && \
$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

livehtml:
@$(SPHINXAUTOBUILD) --watch ../leapp "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(0)
@source venv/bin/activate && \
$(SPHINXAUTOBUILD) --watch ../leapp "$(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); \
# ad. pip install -r doesn't really work with relative paths :), so keeping it in the project root
@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 doesn't really work with relative paths :), so keeping it in the project root
virtualenv venv --python=python$$PY_VER && \
source venv/bin/activate && \
pushd .. && pip install -r requirements-docs.txt; popd

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(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 a6d75a7

Please sign in to comment.