bpo-31036: Allow sphinx and blurb to be found automatically (#3440) · pythoncapi/cpython@590665c · GitHub
Skip to content

Commit 590665c

Browse files
authored
bpo-31036: Allow sphinx and blurb to be found automatically (python#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 5a85167 commit 590665c

3 files changed

Lines changed: 38 additions & 26 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions

Doc/Makefile

Lines changed: 8 additions & 6 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
@@ -168,7 +170,7 @@ dist:
168170
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
169171

170172
check:
171-
$(PYTHON) tools/rstlint.py -i tools -i venv -i README.rst
173+
$(PYTHON) tools/rstlint.py -i tools -i $(VENVDIR) -i README.rst
172174

173175
serve:
174176
../Tools/scripts/serve.py build/html

Doc/README.rst

Lines changed: 27 additions & 20 deletions

0 commit comments

Comments
 (0)