Files

40 lines
1.4 KiB
Python
Raw Permalink Normal View History

2021-01-15 07:30:09 +01:00
# This program requires doxygen, sphinx, breathe and exhale.
2025-12-19 18:53:04 +05:00
import multiprocessing
2021-01-15 07:30:09 +01:00
import os
2021-02-05 12:01:57 +00:00
import shutil
2021-01-15 07:30:09 +01:00
import subprocess
2025-12-19 18:53:04 +05:00
import sys
2021-01-15 07:30:09 +01:00
2021-02-06 15:10:41 +00:00
# some extra check to see if we can find sphinx in pypy bin dir
sphinx_build = os.path.join(os.path.dirname(sys.executable), 'sphinx-build')
if not os.path.exists(sphinx_build):
sphinx_build = "sphinx-build"
2021-02-06 15:24:17 +00:00
# else:
# os.environ['PATH'] = os.pathsep + os.path.dirname(sys.executable)
2021-01-15 07:30:09 +01:00
2021-02-06 15:10:41 +00:00
# not used, -j caused issues in my sphinx install
j = str(multiprocessing.cpu_count())
2021-01-15 07:30:09 +01:00
if not os.path.isdir("./output/doxygen/xml"):
os.makedirs("output/doxygen/xml")
2021-02-06 15:10:41 +00:00
subprocess.check_call([sphinx_build, "-b", "html", ".", "output"])
2021-01-15 07:30:09 +01:00
2021-02-06 15:10:41 +00:00
if sys.platform == "linux" or sys.platform == "linux2":
2021-02-05 12:01:57 +00:00
if os.path.isdir("output/python"):
shutil.rmtree("output/python")
2021-01-15 07:30:09 +01:00
2021-02-05 12:01:57 +00:00
if not os.path.exists(os.path.join("../src/ifcblenderexport/docs", "contents.rst")):
subprocess.check_call(["ln", "index.rst", "contents.rst"], cwd="../src/ifcblenderexport/docs")
2021-02-06 15:10:41 +00:00
2021-02-06 15:24:17 +00:00
subprocess.check_call(["sed", "-i", "s/html_theme/# html_theme/g", "conf.py"], cwd="../src/ifcblenderexport/docs")
2021-02-05 12:01:57 +00:00
subprocess.check_call(["make", "html"], cwd="../src/ifcblenderexport/docs")
2021-02-06 15:24:17 +00:00
subprocess.check_call(["git", "checkout", "conf.py"], cwd="../src/ifcblenderexport/docs")
2021-02-06 15:10:41 +00:00
2021-02-05 12:01:57 +00:00
shutil.move("../src/ifcblenderexport/docs/_build", "./output")
os.rename("./output/_build", "./output/python")
2021-01-15 07:30:09 +01:00
2021-02-06 15:10:41 +00:00
elif sys.platform == "win32" or sys.platform == "win64":
2021-02-05 12:01:57 +00:00
subprocess.check_call(["make.bat", "html"])