Commit 0bd59d65 authored by Benjamin Peterson's avatar Benjamin Peterson Committed by GitHub

[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 590665c3)
Co-authored-by: default avatarNed Deily <nad@python.org>
parent e78d79c1
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
*.profraw *.profraw
*.dyn *.dyn
Doc/build/ Doc/build/
Doc/tools/docutils/ Doc/venv/
Doc/tools/jinja2/ Doc/.venv/
Doc/tools/pygments/ Doc/env/
Doc/tools/sphinx/ Doc/.env/
Lib/lib2to3/*.pickle Lib/lib2to3/*.pickle
Lib/test/data/* Lib/test/data/*
Makefile Makefile
......
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
# You can set these variables from the command line. # You can set these variables from the command line.
PYTHON = python PYTHON = python
SPHINXBUILD = sphinx-build VENVDIR = ./venv
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
PAPER = PAPER =
SOURCES = SOURCES =
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
...@@ -102,7 +104,12 @@ htmlview: html ...@@ -102,7 +104,12 @@ htmlview: html
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
clean: clean:
-rm -rf build/* -rm -rf build/* $(VENVDIR)/*
venv:
$(PYTHON) -m venv $(VENVDIR)
$(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb
@echo "The venv has been created in the $(VENVDIR) directory"
dist: dist:
rm -rf dist rm -rf dist
...@@ -148,7 +155,7 @@ dist: ...@@ -148,7 +155,7 @@ dist:
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
check: check:
$(PYTHON)2 tools/rstlint.py -i tools $(PYTHON)2 tools/rstlint.py -i tools -i $(VENVDIR)
serve: serve:
../Tools/scripts/serve.py build/html ../Tools/scripts/serve.py build/html
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment