##// END OF EJS Templates
Refactor autogen config
klonuo -
Show More
@@ -1,160 +1,159 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 PYTHON = python
11 11
12 12 # Internal variables.
13 13 PAPEROPT_a4 = -D latex_paper_size=a4
14 14 PAPEROPT_letter = -D latex_paper_size=letter
15 15 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
16 16
17 17 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
18 18
19 19 default: html
20 20
21 21 help:
22 22 @echo "Please use \`make <target>' where <target> is one of"
23 23 @echo " html standalone HTML files"
24 24 @echo " html_noapi same as above, without the time consuming API docs"
25 25 @echo " pickle pickle files (usable by e.g. sphinx-web)"
26 26 @echo " htmlhelp HTML files and a HTML help project"
27 27 @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter"
28 28 @echo " texinfo Texinfo files"
29 29 @echo " info Texinfo files and run them through makeinfo"
30 30 @echo " changes an overview over all changed/added/deprecated items"
31 31 @echo " linkcheck check all external links for integrity (takes a long time)"
32 32 @echo " gh-pages clone IPython docs in ./gh-pages/ , build doc, autocommit"
33 33 @echo
34 34 @echo "Compound utility targets:"
35 35 @echo "pdf latex and then runs the PDF generation"
36 36 @echo "all html and pdf"
37 37 @echo "dist all, and then puts the results in dist/"
38 38
39 39 clean_api:
40 40 -rm -rf $(SRCDIR)/api/generated
41 41
42 42 clean: clean_api
43 43 -rm -rf build/* dist/*
44 -cd $(SRCDIR)/config/options; test -f generated && cat generated | xargs rm -f
45 -rm -rf $(SRCDIR)/config/options/generated
44 -rm -f $(SRCDIR)/config/options/config-generated.txt
46 45 -rm -f $(SRCDIR)/interactive/magics-generated.txt
47 46
48 47 pdf: latex
49 48 cd build/latex && make all-pdf
50 49
51 50 all: html pdf
52 51
53 52 # For final distribution, only build HTML (our pdf is now so large as to be
54 53 # unusable, takes forever to build and just bloats the downloads). We leave
55 54 # them hardlinked at the top-level so users find them easily, though the
56 55 # original build/html dir is left in-place (useful to reload builds while
57 56 # testing).
58 57 dist: html
59 58 rm -rf html
60 59 cp -al build/html .
61 60 @echo "Build finished. Final docs are in html/"
62 61
63 62 html: api autoconfig automagic
64 63 html_noapi: clean_api autoconfig automagic
65 64
66 65 html html_noapi:
67 66 mkdir -p build/html build/doctrees
68 67 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
69 68 @echo
70 69 @echo "Build finished. The HTML pages are in build/html."
71 70
72 71 automagic: source/interactive/magics-generated.txt
73 72
74 73 source/interactive/magics-generated.txt: autogen_magics.py
75 74 $(PYTHON) autogen_magics.py
76 75 @echo "Created docs for line & cell magics"
77 76
78 autoconfig: source/config/options/generated
77 autoconfig: source/config/options/config-generated.txt
79 78
80 79 source/config/options/generated:
81 80 $(PYTHON) autogen_config.py
82 81 @echo "Created docs for config options"
83 82
84 83 api: source/api/generated/gen.txt
85 84
86 85 source/api/generated/gen.txt:
87 86 $(PYTHON) autogen_api.py
88 87 @echo "Build API docs finished."
89 88
90 89 pickle:
91 90 mkdir -p build/pickle build/doctrees
92 91 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
93 92 @echo
94 93 @echo "Build finished; now you can process the pickle files or run"
95 94 @echo " sphinx-web build/pickle"
96 95 @echo "to start the sphinx-web server."
97 96
98 97 web: pickle
99 98
100 99 htmlhelp:
101 100 mkdir -p build/htmlhelp build/doctrees
102 101 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
103 102 @echo
104 103 @echo "Build finished; now you can run HTML Help Workshop with the" \
105 104 ".hhp project file in build/htmlhelp."
106 105
107 106 qthelp:
108 107 mkdir -p build/qthelp
109 108 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
110 109 @echo
111 110 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
112 111 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
113 112 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
114 113 @echo "To view the help file:"
115 114 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
116 115
117 116 latex: api autoconfig
118 117 mkdir -p build/latex build/doctrees
119 118 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
120 119 @echo
121 120 @echo "Build finished; the LaTeX files are in build/latex."
122 121 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
123 122 "run these through (pdf)latex."
124 123
125 124 changes:
126 125 mkdir -p build/changes build/doctrees
127 126 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
128 127 @echo
129 128 @echo "The overview file is in build/changes."
130 129
131 130 linkcheck:
132 131 mkdir -p build/linkcheck build/doctrees
133 132 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
134 133 @echo
135 134 @echo "Link check complete; look for any errors in the above output " \
136 135 "or in build/linkcheck/output.rst."
137 136
138 137 nightly: dist
139 138 rsync -avH --delete dist/ ipython:www/doc/nightly
140 139
141 140 gh-pages: clean html
142 141 # if VERSION is unspecified, it will be dev
143 142 # For releases, VERSION should be just the major version,
144 143 # e.g. VERSION=2 make gh-pages
145 144 $(PYTHON) gh-pages.py $(VERSION)
146 145
147 146 texinfo:
148 147 mkdir -p $(BUILDDIR)/texinfo
149 148 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
150 149 @echo
151 150 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
152 151 @echo "Run \`make' in that directory to run these through makeinfo" \
153 152 "(use \`make info' here to do that automatically)."
154 153
155 154 info:
156 155 mkdir -p $(BUILDDIR)/texinfo
157 156 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
158 157 @echo "Running Texinfo files through makeinfo..."
159 158 make -C $(BUILDDIR)/texinfo info
160 159 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@@ -1,28 +1,32 b''
1 1 #!/usr/bin/env python
2 2
3 3 from os.path import join, dirname, abspath
4 4
5 5 from IPython.terminal.ipapp import TerminalIPythonApp
6 6 from ipykernel.kernelapp import IPKernelApp
7 7
8 8 here = abspath(dirname(__file__))
9 9 options = join(here, 'source', 'config', 'options')
10 generated = join(options, 'config-generated.txt')
11
10 12
11 13 def write_doc(name, title, app, preamble=None):
12 filename = '%s.rst' % name
13 with open(join(options, filename), 'w') as f:
14 with open(generated, 'a') as f:
14 15 f.write(title + '\n')
15 16 f.write(('=' * len(title)) + '\n')
16 17 f.write('\n')
17 18 if preamble is not None:
18 19 f.write(preamble + '\n\n')
19 20 f.write(app.document_config_options())
20 21
21 22
22 23 if __name__ == '__main__':
24 # create empty file
25 with open(generated, 'w'):
26 pass
23 27
24 28 write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp())
25 29 write_doc('kernel', 'IPython kernel options', IPKernelApp(),
26 30 preamble=("These options can be used in :file:`ipython_kernel_config.py`. "
27 31 "The kernel also respects any options in `ipython_config.py`"),
28 32 )
@@ -1,12 +1,9 b''
1 1 ===============
2 2 IPython options
3 3 ===============
4 4
5 5 Any of the options listed here can be set in config files, at the
6 6 command line, or from inside IPython. See :ref:`setting_config` for
7 7 details.
8 8
9 .. toctree::
10
11 terminal
12 kernel
9 .. include:: config-generated.txt
General Comments 0
You need to be logged in to leave comments. Login now