##// END OF EJS Templates
Merge pull request #8714 from minrk/confhacks...
Thomas Kluyver -
r21593:b25fc0f0 merge
parent child Browse files
Show More
@@ -1,19 +1,23 b''
1 1 #!/usr/bin/env python
2 2 """Script to auto-generate our API docs.
3 3 """
4 # stdlib imports
4
5 5 import os
6 6 import sys
7 7
8 # local imports
9 sys.path.append(os.path.abspath('sphinxext'))
8 pjoin = os.path.join
9
10 here = os.path.abspath(os.path.dirname(__file__))
11 sys.path.append(pjoin(os.path.abspath(here), 'sphinxext'))
12
10 13 from apigen import ApiDocWriter
11 14
15 source = pjoin(here, 'source')
16
12 17 #*****************************************************************************
13 18 if __name__ == '__main__':
14 pjoin = os.path.join
15 19 package = 'IPython'
16 outdir = pjoin('source','api','generated')
20 outdir = pjoin(source, 'api', 'generated')
17 21 docwriter = ApiDocWriter(package,rst_extension='.rst')
18 22 # You have to escape the . here because . is a special char for regexps.
19 23 # You must do make clean if you change this!
@@ -67,6 +71,6 b" if __name__ == '__main__':"
67 71 # Write index with .txt extension - we can include it, but Sphinx won't try
68 72 # to compile it
69 73 docwriter.write_index(outdir, 'gen.txt',
70 relative_to = pjoin('source','api')
74 relative_to = pjoin(source, 'api')
71 75 )
72 76 print ('%d files written' % len(docwriter.written_modules))
@@ -1,24 +1,30 b''
1 1 #!/usr/bin/env python
2 2
3 from os.path import join, dirname, abspath
4
3 5 from IPython.terminal.ipapp import TerminalIPythonApp
4 6 from ipykernel.kernelapp import IPKernelApp
5 7
8 here = abspath(dirname(__file__))
9 options = join(here, 'source', 'config', 'options')
10 generated = join(options, 'generated.rst')
11
6 12 def write_doc(name, title, app, preamble=None):
7 13 filename = '%s.rst' % name
8 with open('source/config/options/%s' % filename, 'w') as f:
14 with open(join(options, filename), 'w') as f:
9 15 f.write(title + '\n')
10 16 f.write(('=' * len(title)) + '\n')
11 17 f.write('\n')
12 18 if preamble is not None:
13 19 f.write(preamble + '\n\n')
14 20 f.write(app.document_config_options())
15 with open('source/config/options/generated', 'a') as f:
21 with open(generated, 'a') as f:
16 22 f.write(filename + '\n')
17 23
18 24
19 25 if __name__ == '__main__':
20 26 # create empty file
21 with open('source/config/options/generated', 'w'):
27 with open(generated, 'w'):
22 28 pass
23 29
24 30 write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp())
@@ -1,3 +1,5 b''
1 import os
2
1 3 from IPython.core.alias import Alias
2 4 from IPython.core.interactiveshell import InteractiveShell
3 5 from IPython.core.magic import MagicAlias
@@ -60,5 +62,7 b" for name, func in sorted(magics['cell'].items(), key=sortkey):"
60 62 format_docstring(func),
61 63 ""])
62 64
63 with open("source/interactive/magics-generated.txt", "w") as f:
64 f.write("\n".join(output)) No newline at end of file
65 here = os.path.dirname(__file__)
66 dest = os.path.join(here, 'source', 'interactive', 'magics-generated.txt')
67 with open(dest, "w") as f:
68 f.write("\n".join(output))
@@ -1,2 +1,3 b''
1 1 numpydoc
2 2 -e .
3 ipykernel
@@ -24,7 +24,17 b' if ON_RTD:'
24 24 # see
25 25 # http://read-the-docs.readthedocs.org/en/latest/faq.html
26 26 tags.add('rtd')
27
27
28 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
29 for name in ('config', 'api', 'magics'):
30 fname = 'autogen_{}.py'.format(name)
31 fpath = os.path.abspath(os.path.join('..', fname))
32 with open(fpath) as f:
33 exec(compile(f.read(), fname, 'exec'), {
34 '__file__': fpath,
35 '__name__': '__main__',
36 })
37
28 38 # If your extensions are in another directory, add it here. If the directory
29 39 # is relative to the documentation root, use os.path.abspath to make it
30 40 # absolute, like shown here.
General Comments 0
You need to be logged in to leave comments. Login now