From a8edccfa0892bcc58cf36e255d0af3efa1e3747e 2014-04-04 05:24:56 From: Yaroslav Halchenko Date: 2014-04-04 05:24:56 Subject: [PATCH] ENH: list generated config files in generated, and rm them upon clean --- diff --git a/docs/Makefile b/docs/Makefile index 5d34cb7..39e29f7 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -40,6 +40,7 @@ clean_api: clean: clean_api -rm -rf build/* dist/* + -cd $(SRCDIR)/config/options; cat generated | xargs -r rm -f -rm -rf $(SRCDIR)/config/options/generated pdf: latex diff --git a/docs/autogen_config.py b/docs/autogen_config.py old mode 100644 new mode 100755 index 0995a46..1086cf8 --- a/docs/autogen_config.py +++ b/docs/autogen_config.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + from IPython.utils.text import indent, wrap_paragraphs from IPython.terminal.ipapp import TerminalIPythonApp @@ -47,17 +49,25 @@ def document_config_options(classes): kernel_classes = IPKernelApp().classes -def write_doc(filename, title, classes, preamble=None): +def write_doc(name, title, classes, preamble=None): configdoc = document_config_options(classes) - with open('source/config/options/%s.rst' % filename, 'w') as f: + filename = '%s.rst' % name + with open('source/config/options/%s' % filename, 'w') as f: f.write(title + '\n') f.write(('=' * len(title)) + '\n') f.write('\n') if preamble is not None: f.write(preamble + '\n\n') f.write(configdoc) + with open('source/config/options/generated', 'a') as f: + f.write(filename + '\n') + if __name__ == '__main__': + # create empty file + with open('source/config/options/generated', 'w'): + pass + write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes) write_doc('kernel', 'IPython kernel options', kernel_classes, preamble="These options can be used in :file:`ipython_notebook_config.py` " @@ -76,5 +86,3 @@ if __name__ == '__main__': write_doc('qtconsole', 'IPython Qt console options', qtclasses, preamble="Any of the :doc:`kernel` can also be used.") - with open('source/config/options/generated', 'w'): - pass \ No newline at end of file