/
make.py
42 lines (29 loc) · 949 Bytes
/
make.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
39
40
41
42
import os
import sys
import posixpath
"""
Usage python make.py <source_directory> <apidoc_target> <html build target>
<apidoc_target> and <html build target> are optional arguments
"""
command = list()
arg_length = len(sys.argv)
if arg_length < 2:
raise ValueError("Please specify the source directory")
source_directory = sys.argv[1]
if arg_length >= 3:
apidoc_directory = sys.argv[2]
else:
apidoc_directory = './apidoc'
if arg_length == 4:
html_directory = sys.argv[3]
else:
html_directory = './_build'
package_list = ['pyiron', 'vasp', 'base', 'atomistics', 'lammps', 'dft',
'testing']
command.append("make clean")
for pkg in package_list:
directory = posixpath.join(source_directory, pkg)
command.append("sphinx-apidoc -f -o {} {}".format(apidoc_directory, directory))
command.append('make html BUILDDIR={}'.format(html_directory))
for i in range(len(command)):
os.system(command[i])