##// END OF EJS Templates
use pathlib in docs/autogen_config.py
rushabh-v -
Show More
@@ -1,6 +1,5 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2
2
3 from os.path import join, dirname, abspath
4 import inspect
3 import inspect
5 from pathlib import Path
4 from pathlib import Path
6 from IPython.terminal.ipapp import TerminalIPythonApp
5 from IPython.terminal.ipapp import TerminalIPythonApp
@@ -8,9 +7,9 b' from ipykernel.kernelapp import IPKernelApp'
8 from traitlets import Undefined
7 from traitlets import Undefined
9 from collections import defaultdict
8 from collections import defaultdict
10
9
11 here = abspath(dirname(__file__))
10 here = (Path(__file__)).parent
12 options = join(here, 'source', 'config', 'options')
11 options = here / "source" / "config" / "options"
13 generated = join(options, 'config-generated.txt')
12 generated = options / "config-generated.txt"
14
13
15 import textwrap
14 import textwrap
16 indent = lambda text,n: textwrap.indent(text,n*' ')
15 indent = lambda text,n: textwrap.indent(text,n*' ')
@@ -102,11 +101,11 b' def reverse_aliases(app):'
102
101
103 def write_doc(name, title, app, preamble=None):
102 def write_doc(name, title, app, preamble=None):
104 trait_aliases = reverse_aliases(app)
103 trait_aliases = reverse_aliases(app)
105 filename = join(options, name+'.rst')
104 filename = options / name + ".rst"
106 with open(filename, 'w') as f:
105 with open(filename, "w") as f:
107 f.write(title + '\n')
106 f.write(title + "\n")
108 f.write(('=' * len(title)) + '\n')
107 f.write(("=" * len(title)) + "\n")
109 f.write('\n')
108 f.write("\n")
110 if preamble is not None:
109 if preamble is not None:
111 f.write(preamble + '\n\n')
110 f.write(preamble + '\n\n')
112 #f.write(app.document_config_options())
111 #f.write(app.document_config_options())
General Comments 0
You need to be logged in to leave comments. Login now