~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Doc/Makefile

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Makefile for Python documentation
 
3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
4
#
 
5
 
 
6
# You can set these variables from the command line.
 
7
PYTHON       = python
 
8
SVNROOT      = http://svn.python.org/projects
 
9
SPHINXOPTS   =
 
10
PAPER        =
 
11
SOURCES      =
 
12
DISTVERSION  = $(shell $(PYTHON) tools/sphinxext/patchlevel.py)
 
13
 
 
14
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
 
15
                $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
 
16
 
 
17
.PHONY: help checkout update build html htmlhelp latex text changes linkcheck \
 
18
        suspicious coverage doctest pydoc-topics htmlview clean dist check serve \
 
19
        autobuild-dev autobuild-stable
 
20
 
 
21
help:
 
22
        @echo "Please use \`make <target>' where <target> is one of"
 
23
        @echo "  clean      to remove build files"
 
24
        @echo "  update     to update build tools"
 
25
        @echo "  html       to make standalone HTML files"
 
26
        @echo "  htmlhelp   to make HTML files and a HTML help project"
 
27
        @echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
 
28
        @echo "  text       to make plain text files"
 
29
        @echo "  epub       to make EPUB files"
 
30
        @echo "  changes    to make an overview over all changed/added/deprecated items"
 
31
        @echo "  linkcheck  to check all external links for integrity"
 
32
        @echo "  coverage   to check documentation coverage for library and C API"
 
33
        @echo "  doctest    to run doctests in the documentation"
 
34
        @echo "  pydoc-topics  to regenerate the pydoc topics file"
 
35
        @echo "  dist       to create a \"dist\" directory with archived docs for download"
 
36
        @echo "  suspicious to check for suspicious markup in output text"
 
37
        @echo "  check      to run a check for frequent markup errors"
 
38
        @echo "  serve      to serve the documentation on the localhost (8000)"
 
39
 
 
40
# Note: if you update versions here, do the same in make.bat and README.txt
 
41
checkout:
 
42
        @if [ ! -d tools/sphinx ]; then \
 
43
          echo "Checking out Sphinx..."; \
 
44
          svn checkout $(SVNROOT)/external/Sphinx-1.0.7/sphinx tools/sphinx; \
 
45
        fi
 
46
        @if [ ! -d tools/docutils ]; then \
 
47
          echo "Checking out Docutils..."; \
 
48
          svn checkout $(SVNROOT)/external/docutils-0.6/docutils tools/docutils; \
 
49
        fi
 
50
        @if [ ! -d tools/jinja2 ]; then \
 
51
          echo "Checking out Jinja..."; \
 
52
          svn checkout $(SVNROOT)/external/Jinja-2.3.1/jinja2 tools/jinja2; \
 
53
        fi
 
54
        @if [ ! -d tools/pygments ]; then \
 
55
          echo "Checking out Pygments..."; \
 
56
          svn checkout $(SVNROOT)/external/Pygments-1.5dev-20120930/pygments tools/pygments; \
 
57
        fi
 
58
 
 
59
update: clean checkout
 
60
 
 
61
build: checkout
 
62
        mkdir -p build/$(BUILDER) build/doctrees
 
63
        $(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
 
64
        @echo
 
65
 
 
66
html: BUILDER = html
 
67
html: build
 
68
        @echo "Build finished. The HTML pages are in build/html."
 
69
 
 
70
htmlhelp: BUILDER = htmlhelp
 
71
htmlhelp: build
 
72
        @echo "Build finished; now you can run HTML Help Workshop with the" \
 
73
              "build/htmlhelp/pydoc.hhp project file."
 
74
 
 
75
latex: BUILDER = latex
 
76
latex: build
 
77
        @echo "Build finished; the LaTeX files are in build/latex."
 
78
        @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
 
79
              "run these through (pdf)latex."
 
80
 
 
81
text: BUILDER = text
 
82
text: build
 
83
        @echo "Build finished; the text files are in build/text."
 
84
 
 
85
epub: BUILDER = epub
 
86
epub: build
 
87
        @echo "Build finished; the epub files are in build/epub."
 
88
 
 
89
changes: BUILDER = changes
 
90
changes: build
 
91
        @echo "The overview file is in build/changes."
 
92
 
 
93
linkcheck: BUILDER = linkcheck
 
94
linkcheck: build
 
95
        @echo "Link check complete; look for any errors in the above output" \
 
96
              "or in build/$(BUILDER)/output.txt"
 
97
 
 
98
suspicious: BUILDER = suspicious
 
99
suspicious: build
 
100
        @echo "Suspicious check complete; look for any errors in the above output" \
 
101
              "or in build/$(BUILDER)/suspicious.csv.  If all issues are false" \
 
102
              "positives, append that file to tools/sphinxext/susp-ignored.csv."
 
103
 
 
104
coverage: BUILDER = coverage
 
105
coverage: build
 
106
        @echo "Coverage finished; see c.txt and python.txt in build/coverage"
 
107
 
 
108
doctest: BUILDER = doctest
 
109
doctest: build
 
110
        @echo "Testing of doctests in the sources finished, look at the" \
 
111
              "results in build/doctest/output.txt"
 
112
 
 
113
pydoc-topics: BUILDER = pydoc-topics
 
114
pydoc-topics: build
 
115
        @echo "Building finished; now copy build/pydoc-topics/topics.py" \
 
116
              "to ../Lib/pydoc_data/topics.py"
 
117
 
 
118
htmlview: html
 
119
         $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
 
120
 
 
121
clean:
 
122
        -rm -rf build/*
 
123
        -rm -rf tools/sphinx
 
124
        -rm -rf tools/pygments
 
125
        -rm -rf tools/jinja2
 
126
        -rm -rf tools/docutils
 
127
 
 
128
dist:
 
129
        rm -rf dist
 
130
        mkdir -p dist
 
131
 
 
132
        # archive the HTML
 
133
        make html
 
134
        cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
 
135
        tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
 
136
        bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
 
137
        (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)
 
138
        rm -r dist/python-$(DISTVERSION)-docs-html
 
139
        rm dist/python-$(DISTVERSION)-docs-html.tar
 
140
 
 
141
        # archive the text build
 
142
        make text
 
143
        cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
 
144
        tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
 
145
        bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar
 
146
        (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text)
 
147
        rm -r dist/python-$(DISTVERSION)-docs-text
 
148
        rm dist/python-$(DISTVERSION)-docs-text.tar
 
149
 
 
150
        # archive the A4 latex
 
151
        rm -rf build/latex
 
152
        make latex PAPER=a4
 
153
        -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
 
154
        (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
 
155
        cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
 
156
        cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
 
157
 
 
158
        # archive the letter latex
 
159
        rm -rf build/latex
 
160
        make latex PAPER=letter
 
161
        -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
 
162
        (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
 
163
        cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
 
164
        cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
 
165
 
 
166
        # archive the epub build
 
167
        rm -rf build/epub
 
168
        make epub
 
169
        mkdir -p dist/python-$(DISTVERSION)-docs-epub
 
170
        cp -pPR build/epub/*.epub dist/python-$(DISTVERSION)-docs-epub/
 
171
        tar -C dist -cf dist/python-$(DISTVERSION)-docs-epub.tar python-$(DISTVERSION)-docs-epub
 
172
        bzip2 -9 -k dist/python-$(DISTVERSION)-docs-epub.tar
 
173
        (cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-epub.zip python-$(DISTVERSION)-docs-epub)
 
174
        rm -r dist/python-$(DISTVERSION)-docs-epub
 
175
        rm dist/python-$(DISTVERSION)-docs-epub.tar
 
176
 
 
177
check:
 
178
        $(PYTHON) tools/rstlint.py -i tools
 
179
 
 
180
serve:
 
181
        ../Tools/scripts/serve.py build/html
 
182
 
 
183
# Targets for daily automated doc build
 
184
 
 
185
# for development releases: always build
 
186
autobuild-dev:
 
187
        make update
 
188
        make dist SPHINXOPTS='-A daily=1 -A versionswitcher=1'
 
189
 
 
190
# for quick rebuilds (HTML only)
 
191
autobuild-html:
 
192
        make html SPHINXOPTS='-A daily=1 -A versionswitcher=1'
 
193
 
 
194
# for stable releases: only build if not in pre-release stage (alpha, beta, rc)
 
195
autobuild-stable:
 
196
        @case $(DISTVERSION) in *[abc]*) \
 
197
                echo "Not building; $(DISTVERSION) is not a release version."; \
 
198
                exit 1;; \
 
199
        esac
 
200
        @make autobuild-dev
 
201