Skip to content

Commit 9cc3320

Browse files
committed
[3.5] bpo-31036: Allow sphinx and blurb to be found automatically (GH-3440)
Rather than requiring the path to blurb and/or sphinx-build to be specified to the make rule, enhance the Doc/Makefile to look for each first in a virtual environment created by make venv and, if not found, look on the normal process PATH. This allows the Doc/Makefile to take advantage of an installed spinx-build or blurb and, thus, do the right thing most of the time. Also, make the directory for the venv be configurable and document the `make venv` target.
1 parent 5da989c commit 9cc3320

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Doc/Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
# You can set these variables from the command line.
77
PYTHON = python3
8-
SPHINXBUILD = sphinx-build
9-
BLURB = $(PYTHON) -m blurb
8+
VENVDIR = ./venv
9+
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
10+
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
1011
PAPER =
1112
SOURCES =
1213
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
@@ -118,11 +119,12 @@ htmlview: html
118119
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
119120

120121
clean:
121-
-rm -rf build/* venv/*
122+
-rm -rf build/* $(VENVDIR)/*
122123

123124
venv:
124-
$(PYTHON) -m venv venv
125-
./venv/bin/python3 -m pip install -U Sphinx blurb
125+
$(PYTHON) -m venv $(VENVDIR)
126+
$(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb
127+
@echo "The venv has been created in the $(VENVDIR) directory"
126128

127129
dist:
128130
rm -rf dist
@@ -174,15 +176,20 @@ serve:
174176
../Tools/scripts/serve.py build/html
175177

176178
# Targets for daily automated doc build
179+
# By default, Sphinx only rebuilds pages where the page content has changed.
180+
# This means it doesn't always pick up changes to preferred link targets, etc
181+
# To ensure such changes are picked up, we build the published docs with
182+
# `-E` (to ignore the cached environment) and `-a` (to ignore already existing
183+
# output files)
177184

178185
# for development releases: always build
179186
autobuild-dev:
180-
make dist SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A versionswitcher=1'
187+
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1'
181188
-make suspicious
182189

183190
# for quick rebuilds (HTML only)
184191
autobuild-dev-html:
185-
make html SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A versionswitcher=1'
192+
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1'
186193

187194
# for stable releases: only build if not in pre-release stage (alpha, beta)
188195
# release candidate downloads are okay, since the stable tree can be in that stage

0 commit comments

Comments
 (0)