|
1 | 1 | # This program requires doxygen, sphinx, breathe and exhale. |
2 | 2 |
|
3 | 3 | import os |
4 | | -import os.path |
| 4 | +import shutil |
5 | 5 | import subprocess |
6 | 6 |
|
7 | 7 | from sys import platform |
8 | 8 |
|
9 | | - |
10 | | -def copy_content(content, container): |
11 | | - with open(content) as f: |
12 | | - with open(container, "w") as f1: |
13 | | - for line in f: |
14 | | - f1.write(line) |
15 | | - |
16 | | - |
17 | 9 | conf_path = "./conf.py" |
18 | 10 | index_path = "./index.rst" |
19 | 11 |
|
20 | | - |
21 | 12 | if not os.path.isdir("./output/doxygen/xml"): |
22 | 13 | os.makedirs("output/doxygen/xml") |
23 | 14 |
|
24 | | -if os.path.isfile(conf_path) and not os.path.isfile(index_path): |
25 | | - os.remove(conf_path) |
26 | | -if os.path.isfile(index_path) and not os.path.isfile(conf_path): |
27 | | - os.remove(index_path) |
28 | | - |
29 | | -if not (os.path.isfile(conf_path) and os.path.isfile(index_path)): |
30 | | - subprocess.run(["sphinx-quickstart", "-q", "-p", "IfcOpenShell"]) |
31 | | - |
32 | | -conf_copy = ["./conf_to_copy.py", "./conf.py"] |
33 | | -index_copy = ["./index_to_copy.rst", "./index.rst"] |
34 | | - |
35 | | -copy_content(conf_copy[0], conf_copy[1]) |
36 | | -copy_content(index_copy[0], index_copy[1]) |
| 15 | +subprocess.check_call(["sphinx-build", "-b", "html", ".", "output"]) |
37 | 16 |
|
38 | 17 | if platform == "linux" or platform == "linux2": |
39 | | - subprocess.run(["make", "html"]) |
40 | | - if not os.path.isdir("/output/_build"): |
41 | | - subprocess.run(["cd","../src/ifcblenderexport/docs"]) |
42 | | - subprocess.run(["make", "html"]) |
43 | | - subprocess.run(["cd", "../../../docs"]) |
44 | | - |
45 | | - subprocess.run(["mv" "../src/ifcblenderexport/docs/_build", "./output"]) |
| 18 | + if os.path.isdir("output/python"): |
| 19 | + shutil.rmtree("output/python") |
46 | 20 |
|
| 21 | + if not os.path.exists(os.path.join("../src/ifcblenderexport/docs", "contents.rst")): |
| 22 | + subprocess.check_call(["ln", "index.rst", "contents.rst"], cwd="../src/ifcblenderexport/docs") |
| 23 | + subprocess.check_call(["make", "html"], cwd="../src/ifcblenderexport/docs") |
| 24 | + shutil.move("../src/ifcblenderexport/docs/_build", "./output") |
| 25 | + os.rename("./output/_build", "./output/python") |
47 | 26 |
|
48 | 27 | elif platform == "win32" or platform == "win64": |
49 | | - subprocess.run(["make.bat", "html"]) |
50 | | - |
51 | | - |
52 | | - |
| 28 | + subprocess.check_call(["make.bat", "html"]) |
0 commit comments