comparison docs/test2rst.py @ 5657:6e37ce7be367 stable

test2rst: remove the abandoned index building part
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 09 Nov 2020 23:03:31 +0800
parents 60ce376919c5
children 5ea837c515d9
comparison
equal deleted inserted replaced
5656:60ce376919c5 5657:6e37ce7be367
2 2
3 import os 3 import os
4 import re 4 import re
5 import sys 5 import sys
6 6
7 INDEX = '''
8 Mercurial tests
9 ===============
10
11 .. toctree::
12 :maxdepth: 1
13 '''
14 7
15 ignored_patterns = [ 8 ignored_patterns = [
16 re.compile(r'^#if'), 9 re.compile(r'^#if'),
17 re.compile(r'^#else'), 10 re.compile(r'^#else'),
18 re.compile(r'^#endif'), 11 re.compile(r'^#endif'),
72 else: 65 else:
73 one_file(base) 66 one_file(base)
74 67
75 68
76 def one_dir(base): 69 def one_dir(base):
77 index = INDEX
78 # doc = lambda x: op.join(op.dirname(__file__), 'docs', x)
79
80 for fn in sorted(os.listdir(base)): 70 for fn in sorted(os.listdir(base)):
81 if not fn.endswith('.t'): 71 if not fn.endswith('.t'):
82 continue 72 continue
83 name = os.path.splitext(fn)[0]
84 one_file(os.path.join(base, fn)) 73 one_file(os.path.join(base, fn))
85
86 index += '\n ' + name
87
88 # with file(doc('index.rst'), 'w') as f:
89 # f.write(index)
90 74
91 75
92 def one_file(path): 76 def one_file(path):
93 with open(path) as f: 77 with open(path) as f:
94 content = f.read() 78 content = f.read()