Skip to content

Commit 0bd59d6

Browse files
benjaminpned-deily
andauthored
[2.7] bpo-31036: Allow sphinx and blurb to be found automatically (GH-16638)
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.. (cherry picked from commit 590665c) Co-authored-by: Ned Deily <[email protected]>
1 parent e78d79c commit 0bd59d6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
*.profraw
1717
*.dyn
1818
Doc/build/
19-
Doc/tools/docutils/
20-
Doc/tools/jinja2/
21-
Doc/tools/pygments/
22-
Doc/tools/sphinx/
19+
Doc/venv/
20+
Doc/.venv/
21+
Doc/env/
22+
Doc/.env/
2323
Lib/lib2to3/*.pickle
2424
Lib/test/data/*
2525
Makefile

Doc/Makefile

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

66
# You can set these variables from the command line.
77
PYTHON = python
8-
SPHINXBUILD = sphinx-build
8+
VENVDIR = ./venv
9+
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
10+
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
911
PAPER =
1012
SOURCES =
1113
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
@@ -102,7 +104,12 @@ htmlview: html
102104
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
103105

104106
clean:
105-
-rm -rf build/*
107+
-rm -rf build/* $(VENVDIR)/*
108+
109+
venv:
110+
$(PYTHON) -m venv $(VENVDIR)
111+
$(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb
112+
@echo "The venv has been created in the $(VENVDIR) directory"
106113

107114
dist:
108115
rm -rf dist
@@ -148,7 +155,7 @@ dist:
148155
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
149156

150157
check:
151-
$(PYTHON)2 tools/rstlint.py -i tools
158+
$(PYTHON)2 tools/rstlint.py -i tools -i $(VENVDIR)
152159

153160
serve:
154161
../Tools/scripts/serve.py build/html

0 commit comments

Comments
 (0)