##// END OF EJS Templates
require specifying the version for gh-pages...
MinRK -
Show More
@@ -1,137 +1,140 b''
1 1 # Makefile for Sphinx documentation
2 2 #
3 3
4 4 # You can set these variables from the command line.
5 5 SPHINXOPTS =
6 6 SPHINXBUILD = sphinx-build
7 7 PAPER =
8 8 SRCDIR = source
9 9 BUILDDIR = build
10 10
11 11 # Internal variables.
12 12 PAPEROPT_a4 = -D latex_paper_size=a4
13 13 PAPEROPT_letter = -D latex_paper_size=letter
14 14 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
15 15
16 16 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
17 17
18 18 default: html
19 19
20 20 help:
21 21 @echo "Please use \`make <target>' where <target> is one of"
22 22 @echo " html to make standalone HTML files"
23 23 @echo " pickle to make pickle files (usable by e.g. sphinx-web)"
24 24 @echo " htmlhelp to make HTML files and a HTML help project"
25 25 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
26 26 @echo " texinfo to make Texinfo files"
27 27 @echo " info to make Texinfo files and run them through makeinfo"
28 28 @echo " changes to make an overview over all changed/added/deprecated items"
29 29 @echo " linkcheck to check all external links for integrity"
30 30 @echo
31 31 @echo "Compound utility targets:"
32 32 @echo "pdf latex and then runs the PDF generation"
33 33 @echo "all html and pdf"
34 34 @echo "dist all, and then puts the results in dist/"
35 35 @echo "gitwash-update update git workflow from source repo"
36 36
37 37 clean:
38 38 -rm -rf build/* dist/* $(SRCDIR)/api/generated
39 39
40 40 pdf: latex
41 41 cd build/latex && make all-pdf
42 42
43 43 all: html pdf
44 44
45 45 # For final distribution, only build HTML (our pdf is now so large as to be
46 46 # unusable, takes forever to build and just bloats the downloads). We leave
47 47 # them hardlinked at the top-level so users find them easily, though the
48 48 # original build/html dir is left in-place (useful to reload builds while
49 49 # testing).
50 50 dist: html
51 51 rm -rf html
52 52 cp -al build/html .
53 53 @echo "Build finished. Final docs are in html/"
54 54
55 55 html: api
56 56 mkdir -p build/html build/doctrees
57 57 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
58 58 @echo
59 59 @echo "Build finished. The HTML pages are in build/html."
60 60
61 61 api: source/api/generated/gen.txt
62 62
63 63 source/api/generated/gen.txt:
64 64 python autogen_api.py
65 65 @echo "Build API docs finished."
66 66
67 67 pickle:
68 68 mkdir -p build/pickle build/doctrees
69 69 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
70 70 @echo
71 71 @echo "Build finished; now you can process the pickle files or run"
72 72 @echo " sphinx-web build/pickle"
73 73 @echo "to start the sphinx-web server."
74 74
75 75 web: pickle
76 76
77 77 htmlhelp:
78 78 mkdir -p build/htmlhelp build/doctrees
79 79 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
80 80 @echo
81 81 @echo "Build finished; now you can run HTML Help Workshop with the" \
82 82 ".hhp project file in build/htmlhelp."
83 83
84 84 qthelp:
85 85 mkdir -p build/qthelp
86 86 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
87 87 @echo
88 88 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
89 89 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90 90 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
91 91 @echo "To view the help file:"
92 92 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
93 93
94 94 latex: api
95 95 mkdir -p build/latex build/doctrees
96 96 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
97 97 @echo
98 98 @echo "Build finished; the LaTeX files are in build/latex."
99 99 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
100 100 "run these through (pdf)latex."
101 101
102 102 changes:
103 103 mkdir -p build/changes build/doctrees
104 104 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
105 105 @echo
106 106 @echo "The overview file is in build/changes."
107 107
108 108 linkcheck:
109 109 mkdir -p build/linkcheck build/doctrees
110 110 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
111 111 @echo
112 112 @echo "Link check complete; look for any errors in the above output " \
113 113 "or in build/linkcheck/output.rst."
114 114
115 115 gitwash-update:
116 116 python ../tools/gitwash_dumper.py source/development ipython
117 117
118 118 nightly: dist
119 119 rsync -avH --delete dist/ ipython:www/doc/nightly
120 120
121 121 gh-pages: clean html
122 python gh-pages.py
122 # if VERSION is unspecified, it will be dev
123 # For releases, VERSION should be just the major version,
124 # e.g. VERSION=2 make gh-pages
125 python gh-pages.py $(VERSION)
123 126
124 127 texinfo:
125 128 mkdir -p $(BUILDDIR)/texinfo
126 129 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
127 130 @echo
128 131 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
129 132 @echo "Run \`make' in that directory to run these through makeinfo" \
130 133 "(use \`make info' here to do that automatically)."
131 134
132 135 info:
133 136 mkdir -p $(BUILDDIR)/texinfo
134 137 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
135 138 @echo "Running Texinfo files through makeinfo..."
136 139 make -C $(BUILDDIR)/texinfo info
137 140 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@@ -1,138 +1,134 b''
1 1 #!/usr/bin/env python
2 2 """Script to commit the doc build outputs into the github-pages repo.
3 3
4 4 Use:
5 5
6 6 gh-pages.py [tag]
7 7
8 8 If no tag is given, the current output of 'git describe' is used. If given,
9 9 that is how the resulting directory will be named.
10 10
11 11 In practice, you should use either actual clean tags from a current build or
12 12 something like 'current' as a stable URL for the most current version of the """
13 13
14 14 #-----------------------------------------------------------------------------
15 15 # Imports
16 16 #-----------------------------------------------------------------------------
17 17 import os
18 18 import re
19 19 import shutil
20 20 import sys
21 21 from os import chdir as cd
22 22 from os.path import join as pjoin
23 23
24 24 from subprocess import Popen, PIPE, CalledProcessError, check_call
25 25
26 26 #-----------------------------------------------------------------------------
27 27 # Globals
28 28 #-----------------------------------------------------------------------------
29 29
30 30 pages_dir = 'gh-pages'
31 31 html_dir = 'build/html'
32 32 pdf_dir = 'build/latex'
33 33 pages_repo = 'git@github.com:ipython/ipython-doc.git'
34 34
35 35 #-----------------------------------------------------------------------------
36 36 # Functions
37 37 #-----------------------------------------------------------------------------
38 38 def sh(cmd):
39 39 """Execute command in a subshell, return status code."""
40 40 return check_call(cmd, shell=True)
41 41
42 42
43 43 def sh2(cmd):
44 44 """Execute command in a subshell, return stdout.
45 45
46 46 Stderr is unbuffered from the subshell.x"""
47 47 p = Popen(cmd, stdout=PIPE, shell=True)
48 48 out = p.communicate()[0]
49 49 retcode = p.returncode
50 50 if retcode:
51 51 raise CalledProcessError(retcode, cmd)
52 52 else:
53 53 return out.rstrip()
54 54
55 55
56 56 def sh3(cmd):
57 57 """Execute command in a subshell, return stdout, stderr
58 58
59 59 If anything appears in stderr, print it out to sys.stderr"""
60 60 p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
61 61 out, err = p.communicate()
62 62 retcode = p.returncode
63 63 if retcode:
64 64 raise CalledProcessError(retcode, cmd)
65 65 else:
66 66 return out.rstrip(), err.rstrip()
67 67
68 68
69 69 def init_repo(path):
70 70 """clone the gh-pages repo if we haven't already."""
71 71 sh("git clone %s %s"%(pages_repo, path))
72 72 here = os.getcwdu()
73 73 cd(path)
74 74 sh('git checkout gh-pages')
75 75 cd(here)
76 76
77 77 #-----------------------------------------------------------------------------
78 78 # Script starts
79 79 #-----------------------------------------------------------------------------
80 80 if __name__ == '__main__':
81 81 # The tag can be given as a positional argument
82 82 try:
83 83 tag = sys.argv[1]
84 84 except IndexError:
85 try:
86 tag = sh2('git describe --exact-match')
87 except CalledProcessError:
88 tag = "dev" # Fallback
85 tag = "dev"
89 86
90 87 startdir = os.getcwdu()
91 88 if not os.path.exists(pages_dir):
92 89 # init the repo
93 90 init_repo(pages_dir)
94 91 else:
95 92 # ensure up-to-date before operating
96 93 cd(pages_dir)
97 94 sh('git checkout gh-pages')
98 95 sh('git pull')
99 96 cd(startdir)
100 97
101 98 dest = pjoin(pages_dir, tag)
102 99
103 100 # don't `make html` here, because gh-pages already depends on html in Makefile
104 101 # sh('make html')
105 102 if tag != 'dev':
106 103 # only build pdf for non-dev targets
107 104 #sh2('make pdf')
108 105 pass
109 106
110 107 # This is pretty unforgiving: we unconditionally nuke the destination
111 108 # directory, and then copy the html tree in there
112 109 shutil.rmtree(dest, ignore_errors=True)
113 110 shutil.copytree(html_dir, dest)
114 111 if tag != 'dev':
115 112 #shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))
116 113 pass
117 114
118 115 try:
119 116 cd(pages_dir)
120 status = sh2('git status | head -1')
121 branch = re.match('\# On branch (.*)$', status).group(1)
117 branch = sh2('git rev-parse --abbrev-ref HEAD').strip()
122 118 if branch != 'gh-pages':
123 119 e = 'On %r, git branch is %r, MUST be "gh-pages"' % (pages_dir,
124 120 branch)
125 121 raise RuntimeError(e)
126 122
127 123 sh('git add -A %s' % tag)
128 124 sh('git commit -m"Updated doc release: %s"' % tag)
129 125 print
130 126 print 'Most recent 3 commits:'
131 127 sys.stdout.flush()
132 128 sh('git --no-pager log --oneline HEAD~3..')
133 129 finally:
134 130 cd(startdir)
135 131
136 132 print
137 133 print 'Now verify the build in: %r' % dest
138 134 print "If everything looks good, 'git push'"
General Comments 0
You need to be logged in to leave comments. Login now