-
Notifications
You must be signed in to change notification settings - Fork 115
/
build_docs.py
38 lines (30 loc) · 883 Bytes
/
build_docs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import pycco
import shutil
modules = [
'paip/',
'paip/examples/gps',
'paip/examples/eliza',
'paip/examples/search',
'paip/examples/logic',
'paip/examples/emycin',
'paip/examples/othello',
'./'
]
outdir = 'docs'
prolog_examples = 'paip/examples/prolog'
def module_sources(module):
sources = []
for filename in os.listdir(os.path.abspath(module)):
if filename != '__init__.py' and filename.endswith('.py'):
sources.append(os.path.join(module, filename))
return sources
def main():
sources = []
for module in modules:
sources.extend(module_sources(module))
pycco.process(sources, outdir=outdir)
shutil.rmtree(os.path.join(outdir, prolog_examples), True)
shutil.copytree(prolog_examples, os.path.join(outdir, prolog_examples))
if __name__ == '__main__':
main()