|
1 | 1 | # This program requires doxygen, sphinx, breathe and exhale. |
2 | 2 |
|
3 | 3 | import os |
| 4 | +import sys |
4 | 5 | import shutil |
5 | 6 | import subprocess |
| 7 | +import multiprocessing |
6 | 8 |
|
7 | | -from sys import platform |
| 9 | +# some extra check to see if we can find sphinx in pypy bin dir |
| 10 | +sphinx_build = os.path.join(os.path.dirname(sys.executable), 'sphinx-build') |
| 11 | +if not os.path.exists(sphinx_build): |
| 12 | + sphinx_build = "sphinx-build" |
| 13 | +else: |
| 14 | + os.environ['PATH'] += os.pathsep + os.path.dirname(sys.executable) |
8 | 15 |
|
9 | | -conf_path = "./conf.py" |
10 | | -index_path = "./index.rst" |
| 16 | +# not used, -j caused issues in my sphinx install |
| 17 | +j = str(multiprocessing.cpu_count()) |
11 | 18 |
|
12 | 19 | if not os.path.isdir("./output/doxygen/xml"): |
13 | 20 | os.makedirs("output/doxygen/xml") |
14 | 21 |
|
15 | | -subprocess.check_call(["sphinx-build", "-b", "html", ".", "output"]) |
| 22 | +subprocess.check_call([sphinx_build, "-b", "html", ".", "output"]) |
16 | 23 |
|
17 | | -if platform == "linux" or platform == "linux2": |
| 24 | +if sys.platform == "linux" or sys.platform == "linux2": |
18 | 25 | if os.path.isdir("output/python"): |
19 | 26 | shutil.rmtree("output/python") |
20 | 27 |
|
21 | 28 | if not os.path.exists(os.path.join("../src/ifcblenderexport/docs", "contents.rst")): |
22 | 29 | subprocess.check_call(["ln", "index.rst", "contents.rst"], cwd="../src/ifcblenderexport/docs") |
| 30 | + |
| 31 | + subprocess.check_call(["sed", "-i", "s/html_theme/# html_theme/g", "conf.py"], cwd="../src/ifcblenderexport/docs")) |
23 | 32 | subprocess.check_call(["make", "html"], cwd="../src/ifcblenderexport/docs") |
| 33 | + subprocess.check_call(["git", "checkout", "conf.py"], cwd="../src/ifcblenderexport/docs")) |
| 34 | + |
24 | 35 | shutil.move("../src/ifcblenderexport/docs/_build", "./output") |
25 | 36 | os.rename("./output/_build", "./output/python") |
26 | 37 |
|
27 | | -elif platform == "win32" or platform == "win64": |
| 38 | +elif sys.platform == "win32" or sys.platform == "win64": |
28 | 39 | subprocess.check_call(["make.bat", "html"]) |
0 commit comments