Skip to content

Commit 5d7fc42

Browse files
authored
Backport Doc build venv fixes (python#3979)
1 parent 727f419 commit 5d7fc42

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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
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/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
# Require Sphinx 1.2 for build.
3737
needs_sphinx = '1.2'
3838

39+
# Ignore any .rst files in the venv/ directory.
40+
venvdir = os.getenv('VENVDIR', 'venv')
41+
exclude_patterns = [venvdir+'/*', 'README.rst']
42+
3943

4044
# Options for HTML output
4145
# -----------------------

0 commit comments

Comments
 (0)