| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
PYTHON = python |
| 8 |
VENVDIR = ./venv |
| 9 |
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build |
| 10 |
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb |
| 11 |
PAPER = |
| 12 |
SOURCES = |
| 13 |
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) |
| 14 |
|
| 15 |
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_elements.papersize=$(PAPER) \ |
| 16 |
$(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) |
| 17 |
|
| 18 |
.PHONY: help build html htmlhelp latex text changes linkcheck \ |
| 19 |
suspicious coverage doctest pydoc-topics htmlview clean dist check serve \ |
| 20 |
autobuild-dev autobuild-stable |
| 21 |
|
| 22 |
help: |
| 23 |
@echo "Please use \`make <target>' where <target> is one of" |
| 24 |
@echo " clean to remove build files" |
| 25 |
@echo " html to make standalone HTML files" |
| 26 |
@echo " htmlview to open the index page built by the html target in your browser" |
| 27 |
@echo " htmlhelp to make HTML files and a HTML help project" |
| 28 |
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
| 29 |
@echo " text to make plain text files" |
| 30 |
@echo " epub to make EPUB files" |
| 31 |
@echo " changes to make an overview over all changed/added/deprecated items" |
| 32 |
@echo " linkcheck to check all external links for integrity" |
| 33 |
@echo " coverage to check documentation coverage for library and C API" |
| 34 |
@echo " doctest to run doctests in the documentation" |
| 35 |
@echo " pydoc-topics to regenerate the pydoc topics file" |
| 36 |
@echo " dist to create a \"dist\" directory with archived docs for download" |
| 37 |
@echo " suspicious to check for suspicious markup in output text" |
| 38 |
@echo " check to run a check for frequent markup errors" |
| 39 |
@echo " serve to serve the documentation on the localhost (8000)" |
| 40 |
|
| 41 |
build: |
| 42 |
$(SPHINXBUILD) $(ALLSPHINXOPTS) |
| 43 |
@echo |
| 44 |
|
| 45 |
html: BUILDER = html |
| 46 |
html: build |
| 47 |
@echo "Build finished. The HTML pages are in build/html." |
| 48 |
|
| 49 |
htmlhelp: BUILDER = htmlhelp |
| 50 |
htmlhelp: build |
| 51 |
@echo "Build finished; now you can run HTML Help Workshop with the" \ |
| 52 |
"build/htmlhelp/pydoc.hhp project file." |
| 53 |
|
| 54 |
latex: BUILDER = latex |
| 55 |
latex: build |
| 56 |
@echo "Build finished; the LaTeX files are in build/latex." |
| 57 |
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
| 58 |
"run these through (pdf)latex." |
| 59 |
|
| 60 |
text: BUILDER = text |
| 61 |
text: build |
| 62 |
@echo "Build finished; the text files are in build/text." |
| 63 |
|
| 64 |
epub: BUILDER = epub |
| 65 |
epub: build |
| 66 |
@echo "Build finished; the epub files are in build/epub." |
| 67 |
|
| 68 |
changes: BUILDER = changes |
| 69 |
changes: build |
| 70 |
@echo "The overview file is in build/changes." |
| 71 |
|
| 72 |
linkcheck: BUILDER = linkcheck |
| 73 |
linkcheck: |
| 74 |
@$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 75 |
echo "Link check complete; look for any errors in the above output" \ |
| 76 |
"or in build/$(BUILDER)/output.txt"; \ |
| 77 |
false; } |
| 78 |
|
| 79 |
suspicious: BUILDER = suspicious |
| 80 |
suspicious: |
| 81 |
@$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 82 |
echo "Suspicious check complete; look for any errors in the above output" \ |
| 83 |
"or in build/$(BUILDER)/suspicious.csv. If all issues are false" \ |
| 84 |
"positives, append that file to tools/susp-ignored.csv."; \ |
| 85 |
false; } |
| 86 |
|
| 87 |
coverage: BUILDER = coverage |
| 88 |
coverage: build |
| 89 |
@echo "Coverage finished; see c.txt and python.txt in build/coverage" |
| 90 |
|
| 91 |
doctest: BUILDER = doctest |
| 92 |
doctest: |
| 93 |
@$(MAKE) build BUILDER=$(BUILDER) || { \ |
| 94 |
echo "Testing of doctests in the sources finished, look at the" \ |
| 95 |
"results in build/doctest/output.txt"; \ |
| 96 |
false; } |
| 97 |
|
| 98 |
pydoc-topics: BUILDER = pydoc-topics |
| 99 |
pydoc-topics: build |
| 100 |
@echo "Building finished; now copy build/pydoc-topics/topics.py" \ |
| 101 |
"to ../Lib/pydoc_data/topics.py" |
| 102 |
|
| 103 |
htmlview: html |
| 104 |
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" |
| 105 |
|
| 106 |
clean: |
| 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" |
| 113 |
|
| 114 |
dist: |
| 115 |
rm -rf dist |
| 116 |
mkdir -p dist |
| 117 |
|
| 118 |
# archive the HTML |
| 119 |
make html |
| 120 |
cp -pPR build/html dist/python-$(DISTVERSION)-docs-html |
| 121 |
tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html |
| 122 |
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar |
| 123 |
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html) |
| 124 |
rm -r dist/python-$(DISTVERSION)-docs-html |
| 125 |
rm dist/python-$(DISTVERSION)-docs-html.tar |
| 126 |
|
| 127 |
# archive the text build |
| 128 |
make text |
| 129 |
cp -pPR build/text dist/python-$(DISTVERSION)-docs-text |
| 130 |
tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text |
| 131 |
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar |
| 132 |
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text) |
| 133 |
rm -r dist/python-$(DISTVERSION)-docs-text |
| 134 |
rm dist/python-$(DISTVERSION)-docs-text.tar |
| 135 |
|
| 136 |
# archive the A4 latex |
| 137 |
rm -rf build/latex |
| 138 |
make latex PAPER=a4 |
| 139 |
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile |
| 140 |
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) |
| 141 |
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip |
| 142 |
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2 |
| 143 |
|
| 144 |
# archive the letter latex |
| 145 |
rm -rf build/latex |
| 146 |
make latex PAPER=letter |
| 147 |
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile |
| 148 |
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) |
| 149 |
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip |
| 150 |
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2 |
| 151 |
|
| 152 |
# copy the epub build |
| 153 |
rm -rf build/epub |
| 154 |
make epub |
| 155 |
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub |
| 156 |
|
| 157 |
check: |
| 158 |
$(PYTHON)2 tools/rstlint.py -i tools -i $(VENVDIR) |
| 159 |
|
| 160 |
serve: |
| 161 |
../Tools/scripts/serve.py build/html |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
autobuild-dev: |
| 167 |
make dist SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A switchers=1' |
| 168 |
-make suspicious |
| 169 |
|
| 170 |
|
| 171 |
autobuild-dev-html: |
| 172 |
make html SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A switchers=1' |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
autobuild-stable: |
| 177 |
@case $(DISTVERSION) in *[ab]*) \ |
| 178 |
echo "Not building; $(DISTVERSION) is not a release version."; \ |
| 179 |
exit 1;; \ |
| 180 |
esac |
| 181 |
@make autobuild-dev |
| 182 |
|
| 183 |
autobuild-stable-html: |
| 184 |
@case $(DISTVERSION) in *[ab]*) \ |
| 185 |
echo "Not building; $(DISTVERSION) is not a release version."; \ |
| 186 |
exit 1;; \ |
| 187 |
esac |
| 188 |
@make autobuild-dev-html |