Show More
@@ -0,0 +1,43 b'' | |||||
|
1 | """ | |||
|
2 | This tool is used during CI testing to make sure sphinx raise no error. | |||
|
3 | ||||
|
4 | During development, we like to have whatsnew/pr/*.rst documents to track | |||
|
5 | individual new features. Unfortunately they other either: | |||
|
6 | - have no title (sphinx complains) | |||
|
7 | - are not included in any toctree (sphinx complain) | |||
|
8 | ||||
|
9 | This fix-them up by "inventing" a title, before building the docs. At release | |||
|
10 | time, these title and files will anyway be rewritten into the actual release | |||
|
11 | notes. | |||
|
12 | """ | |||
|
13 | ||||
|
14 | import glob | |||
|
15 | ||||
|
16 | ||||
|
17 | def main(): | |||
|
18 | folder = 'docs/source/whatsnew/pr/' | |||
|
19 | assert folder.endswith('/') | |||
|
20 | files = glob.glob(folder+'*.rst') | |||
|
21 | print(files) | |||
|
22 | ||||
|
23 | for filename in files: | |||
|
24 | print('Adding pseudo-title to:', filename) | |||
|
25 | title = filename[:-4].split('/')[-1].replace('-', ' ').capitalize() | |||
|
26 | ||||
|
27 | with open(filename) as f: | |||
|
28 | data = f.read() | |||
|
29 | if data and data.splitlines()[1].startswith('='): | |||
|
30 | continue | |||
|
31 | ||||
|
32 | with open(filename, 'w') as f: | |||
|
33 | f.write(title+'\n') | |||
|
34 | f.write('='* len(title)+'\n\n') | |||
|
35 | f.write(data) | |||
|
36 | ||||
|
37 | if __name__ == '__main__': | |||
|
38 | main() | |||
|
39 | ||||
|
40 | ||||
|
41 | ||||
|
42 | ||||
|
43 |
General Comments 0
You need to be logged in to leave comments.
Login now