Show More
@@ -1,154 +1,155 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 standalone HTML files" |
|
23 | 23 | @echo " html_noapi same as above, without the time consuming API docs" |
|
24 | 24 | @echo " pickle pickle files (usable by e.g. sphinx-web)" |
|
25 | 25 | @echo " htmlhelp HTML files and a HTML help project" |
|
26 | 26 | @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter" |
|
27 | 27 | @echo " texinfo Texinfo files" |
|
28 | 28 | @echo " info Texinfo files and run them through makeinfo" |
|
29 | 29 | @echo " changes an overview over all changed/added/deprecated items" |
|
30 | 30 | @echo " linkcheck check all external links for integrity (takes a long time)" |
|
31 | 31 | @echo |
|
32 | 32 | @echo "Compound utility targets:" |
|
33 | 33 | @echo "pdf latex and then runs the PDF generation" |
|
34 | 34 | @echo "all html and pdf" |
|
35 | 35 | @echo "dist all, and then puts the results in dist/" |
|
36 | 36 | @echo "gitwash-update update git workflow from source repo" |
|
37 | 37 | |
|
38 | 38 | clean_api: |
|
39 | 39 | -rm -rf $(SRCDIR)/api/generated |
|
40 | 40 | |
|
41 | 41 | clean: clean_api |
|
42 | 42 | -rm -rf build/* dist/* |
|
43 | -cd $(SRCDIR)/config/options; cat generated | xargs -r rm -f | |
|
43 | 44 | -rm -rf $(SRCDIR)/config/options/generated |
|
44 | 45 | |
|
45 | 46 | pdf: latex |
|
46 | 47 | cd build/latex && make all-pdf |
|
47 | 48 | |
|
48 | 49 | all: html pdf |
|
49 | 50 | |
|
50 | 51 | # For final distribution, only build HTML (our pdf is now so large as to be |
|
51 | 52 | # unusable, takes forever to build and just bloats the downloads). We leave |
|
52 | 53 | # them hardlinked at the top-level so users find them easily, though the |
|
53 | 54 | # original build/html dir is left in-place (useful to reload builds while |
|
54 | 55 | # testing). |
|
55 | 56 | dist: html |
|
56 | 57 | rm -rf html |
|
57 | 58 | cp -al build/html . |
|
58 | 59 | @echo "Build finished. Final docs are in html/" |
|
59 | 60 | |
|
60 | 61 | html: api autoconfig |
|
61 | 62 | html_noapi: clean_api autoconfig |
|
62 | 63 | |
|
63 | 64 | html html_noapi: |
|
64 | 65 | mkdir -p build/html build/doctrees |
|
65 | 66 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html |
|
66 | 67 | @echo |
|
67 | 68 | @echo "Build finished. The HTML pages are in build/html." |
|
68 | 69 | |
|
69 | 70 | autoconfig: source/config/options/generated |
|
70 | 71 | |
|
71 | 72 | source/config/options/generated: |
|
72 | 73 | python autogen_config.py |
|
73 | 74 | @echo "Created docs for config options" |
|
74 | 75 | |
|
75 | 76 | api: source/api/generated/gen.txt |
|
76 | 77 | |
|
77 | 78 | source/api/generated/gen.txt: |
|
78 | 79 | python autogen_api.py |
|
79 | 80 | @echo "Build API docs finished." |
|
80 | 81 | |
|
81 | 82 | pickle: |
|
82 | 83 | mkdir -p build/pickle build/doctrees |
|
83 | 84 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle |
|
84 | 85 | @echo |
|
85 | 86 | @echo "Build finished; now you can process the pickle files or run" |
|
86 | 87 | @echo " sphinx-web build/pickle" |
|
87 | 88 | @echo "to start the sphinx-web server." |
|
88 | 89 | |
|
89 | 90 | web: pickle |
|
90 | 91 | |
|
91 | 92 | htmlhelp: |
|
92 | 93 | mkdir -p build/htmlhelp build/doctrees |
|
93 | 94 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp |
|
94 | 95 | @echo |
|
95 | 96 | @echo "Build finished; now you can run HTML Help Workshop with the" \ |
|
96 | 97 | ".hhp project file in build/htmlhelp." |
|
97 | 98 | |
|
98 | 99 | qthelp: |
|
99 | 100 | mkdir -p build/qthelp |
|
100 | 101 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp |
|
101 | 102 | @echo |
|
102 | 103 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ |
|
103 | 104 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" |
|
104 | 105 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp" |
|
105 | 106 | @echo "To view the help file:" |
|
106 | 107 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc" |
|
107 | 108 | |
|
108 | 109 | latex: api autoconfig |
|
109 | 110 | mkdir -p build/latex build/doctrees |
|
110 | 111 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex |
|
111 | 112 | @echo |
|
112 | 113 | @echo "Build finished; the LaTeX files are in build/latex." |
|
113 | 114 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ |
|
114 | 115 | "run these through (pdf)latex." |
|
115 | 116 | |
|
116 | 117 | changes: |
|
117 | 118 | mkdir -p build/changes build/doctrees |
|
118 | 119 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes |
|
119 | 120 | @echo |
|
120 | 121 | @echo "The overview file is in build/changes." |
|
121 | 122 | |
|
122 | 123 | linkcheck: |
|
123 | 124 | mkdir -p build/linkcheck build/doctrees |
|
124 | 125 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck |
|
125 | 126 | @echo |
|
126 | 127 | @echo "Link check complete; look for any errors in the above output " \ |
|
127 | 128 | "or in build/linkcheck/output.rst." |
|
128 | 129 | |
|
129 | 130 | gitwash-update: |
|
130 | 131 | python ../tools/gitwash_dumper.py source/development ipython |
|
131 | 132 | |
|
132 | 133 | nightly: dist |
|
133 | 134 | rsync -avH --delete dist/ ipython:www/doc/nightly |
|
134 | 135 | |
|
135 | 136 | gh-pages: clean html |
|
136 | 137 | # if VERSION is unspecified, it will be dev |
|
137 | 138 | # For releases, VERSION should be just the major version, |
|
138 | 139 | # e.g. VERSION=2 make gh-pages |
|
139 | 140 | python gh-pages.py $(VERSION) |
|
140 | 141 | |
|
141 | 142 | texinfo: |
|
142 | 143 | mkdir -p $(BUILDDIR)/texinfo |
|
143 | 144 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
|
144 | 145 | @echo |
|
145 | 146 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." |
|
146 | 147 | @echo "Run \`make' in that directory to run these through makeinfo" \ |
|
147 | 148 | "(use \`make info' here to do that automatically)." |
|
148 | 149 | |
|
149 | 150 | info: |
|
150 | 151 | mkdir -p $(BUILDDIR)/texinfo |
|
151 | 152 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
|
152 | 153 | @echo "Running Texinfo files through makeinfo..." |
|
153 | 154 | make -C $(BUILDDIR)/texinfo info |
|
154 | 155 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." |
@@ -1,80 +1,88 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | ||
|
1 | 3 | from IPython.utils.text import indent, wrap_paragraphs |
|
2 | 4 | |
|
3 | 5 | from IPython.terminal.ipapp import TerminalIPythonApp |
|
4 | 6 | from IPython.kernel.zmq.kernelapp import IPKernelApp |
|
5 | 7 | from IPython.html.notebookapp import NotebookApp |
|
6 | 8 | |
|
7 | 9 | def document_config_options(classes): |
|
8 | 10 | lines = [] |
|
9 | 11 | for cls in classes: |
|
10 | 12 | classname = cls.__name__ |
|
11 | 13 | for k, trait in sorted(cls.class_traits(config=True).items()): |
|
12 | 14 | ttype = trait.__class__.__name__ |
|
13 | 15 | |
|
14 | 16 | termline = classname + '.' + trait.name |
|
15 | 17 | |
|
16 | 18 | # Choices or type |
|
17 | 19 | if 'Enum' in ttype: |
|
18 | 20 | # include Enum choices |
|
19 | 21 | termline += ' : ' + '|'.join(repr(x) for x in trait.values) |
|
20 | 22 | else: |
|
21 | 23 | termline += ' : ' + ttype |
|
22 | 24 | lines.append(termline) |
|
23 | 25 | |
|
24 | 26 | # Default value |
|
25 | 27 | try: |
|
26 | 28 | dv = trait.get_default_value() |
|
27 | 29 | dvr = repr(dv) |
|
28 | 30 | except Exception: |
|
29 | 31 | dvr = dv = None # ignore defaults we can't construct |
|
30 | 32 | if (dv is not None) and (dvr is not None): |
|
31 | 33 | if len(dvr) > 64: |
|
32 | 34 | dvr = dvr[:61]+'...' |
|
33 | 35 | # Double up backslashes, so they get to the rendered docs |
|
34 | 36 | dvr = dvr.replace('\\n', '\\\\n') |
|
35 | 37 | lines.append(' Default: ' + dvr) |
|
36 | 38 | lines.append('') |
|
37 | 39 | |
|
38 | 40 | help = trait.get_metadata('help') |
|
39 | 41 | if help is not None: |
|
40 | 42 | help = '\n\n'.join(wrap_paragraphs(help, 76)) |
|
41 | 43 | lines.append(indent(help, 4)) |
|
42 | 44 | else: |
|
43 | 45 | lines.append(' No description') |
|
44 | 46 | |
|
45 | 47 | lines.append('') |
|
46 | 48 | return '\n'.join(lines) |
|
47 | 49 | |
|
48 | 50 | kernel_classes = IPKernelApp().classes |
|
49 | 51 | |
|
50 |
def write_doc( |
|
|
52 | def write_doc(name, title, classes, preamble=None): | |
|
51 | 53 | configdoc = document_config_options(classes) |
|
52 | with open('source/config/options/%s.rst' % filename, 'w') as f: | |
|
54 | filename = '%s.rst' % name | |
|
55 | with open('source/config/options/%s' % filename, 'w') as f: | |
|
53 | 56 | f.write(title + '\n') |
|
54 | 57 | f.write(('=' * len(title)) + '\n') |
|
55 | 58 | f.write('\n') |
|
56 | 59 | if preamble is not None: |
|
57 | 60 | f.write(preamble + '\n\n') |
|
58 | 61 | f.write(configdoc) |
|
62 | with open('source/config/options/generated', 'a') as f: | |
|
63 | f.write(filename + '\n') | |
|
64 | ||
|
59 | 65 | |
|
60 | 66 | if __name__ == '__main__': |
|
67 | # create empty file | |
|
68 | with open('source/config/options/generated', 'w'): | |
|
69 | pass | |
|
70 | ||
|
61 | 71 | write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes) |
|
62 | 72 | write_doc('kernel', 'IPython kernel options', kernel_classes, |
|
63 | 73 | preamble="These options can be used in :file:`ipython_notebook_config.py` " |
|
64 | 74 | "or in :file:`ipython_qtconsole_config.py`") |
|
65 | 75 | nbclasses = set(NotebookApp().classes) - set(kernel_classes) |
|
66 | 76 | write_doc('notebook', 'IPython notebook options', nbclasses, |
|
67 | 77 | preamble="Any of the :doc:`kernel` can also be used.") |
|
68 | 78 | |
|
69 | 79 | try: |
|
70 | 80 | from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp |
|
71 | 81 | except ImportError: |
|
72 | 82 | print("WARNING: Could not import qtconsoleapp. Config options for the " |
|
73 | 83 | "Qt Console will not be documented.") |
|
74 | 84 | else: |
|
75 | 85 | qtclasses = set(IPythonQtConsoleApp().classes) - set(kernel_classes) |
|
76 | 86 | write_doc('qtconsole', 'IPython Qt console options', qtclasses, |
|
77 | 87 | preamble="Any of the :doc:`kernel` can also be used.") |
|
78 | 88 | |
|
79 | with open('source/config/options/generated', 'w'): | |
|
80 | pass No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now