##// END OF EJS Templates
ENH: list generated config files in generated, and rm them upon clean
Yaroslav Halchenko -
Show More
@@ -40,6 +40,7 b' clean_api:'
40
40
41 clean: clean_api
41 clean: clean_api
42 -rm -rf build/* dist/*
42 -rm -rf build/* dist/*
43 -cd $(SRCDIR)/config/options; cat generated | xargs -r rm -f
43 -rm -rf $(SRCDIR)/config/options/generated
44 -rm -rf $(SRCDIR)/config/options/generated
44
45
45 pdf: latex
46 pdf: latex
@@ -1,3 +1,5 b''
1 #!/usr/bin/env python
2
1 from IPython.utils.text import indent, wrap_paragraphs
3 from IPython.utils.text import indent, wrap_paragraphs
2
4
3 from IPython.terminal.ipapp import TerminalIPythonApp
5 from IPython.terminal.ipapp import TerminalIPythonApp
@@ -47,17 +49,25 b' def document_config_options(classes):'
47
49
48 kernel_classes = IPKernelApp().classes
50 kernel_classes = IPKernelApp().classes
49
51
50 def write_doc(filename, title, classes, preamble=None):
52 def write_doc(name, title, classes, preamble=None):
51 configdoc = document_config_options(classes)
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 f.write(title + '\n')
56 f.write(title + '\n')
54 f.write(('=' * len(title)) + '\n')
57 f.write(('=' * len(title)) + '\n')
55 f.write('\n')
58 f.write('\n')
56 if preamble is not None:
59 if preamble is not None:
57 f.write(preamble + '\n\n')
60 f.write(preamble + '\n\n')
58 f.write(configdoc)
61 f.write(configdoc)
62 with open('source/config/options/generated', 'a') as f:
63 f.write(filename + '\n')
64
59
65
60 if __name__ == '__main__':
66 if __name__ == '__main__':
67 # create empty file
68 with open('source/config/options/generated', 'w'):
69 pass
70
61 write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes)
71 write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes)
62 write_doc('kernel', 'IPython kernel options', kernel_classes,
72 write_doc('kernel', 'IPython kernel options', kernel_classes,
63 preamble="These options can be used in :file:`ipython_notebook_config.py` "
73 preamble="These options can be used in :file:`ipython_notebook_config.py` "
@@ -76,5 +86,3 b" if __name__ == '__main__':"
76 write_doc('qtconsole', 'IPython Qt console options', qtclasses,
86 write_doc('qtconsole', 'IPython Qt console options', qtclasses,
77 preamble="Any of the :doc:`kernel` can also be used.")
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