Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions obidog/wrappers/doxygen_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,28 @@
import tempfile

from obidog.config import SOURCE_DIRECTORIES
from obidog.logger import log


DOXYGEN_PATH = os.environ.get("DOXYGEN_PATH", "doxygen")

def _check_doxygen():
try:
with subprocess.Popen(
[DOXYGEN_PATH, "--version"], stdout=subprocess.PIPE
) as doxygen_exec:
version = doxygen_exec.stdout.read().decode("utf-8").strip()
try:
version = version.split()[0].split(".")
if int(version[0]) >= 1 and int(version[1]) >= 8 and int(version[2]) >= 18:
return True
else:
return False
except:
return False
except FileNotFoundError as e:
return False

def build_doxygen_documentation(source_path):
path = tempfile.mkdtemp()
src_directories = [
Expand All @@ -19,6 +39,10 @@ def build_doxygen_documentation(source_path):
"{{input_directories}}", (" \\\n" + " " * 25).join(src_directories)
)
)
with open(os.path.join(path, "out.log"), "w") as log:
subprocess.run(["doxygen", "Doxyfile"], cwd=path, stdout=log, stderr=log)
with open(os.path.join(path, "out.log"), "w") as logger:
subprocess.run([DOXYGEN_PATH, "Doxyfile"], cwd=path, stdout=logger, stderr=logger)
return path


if not _check_doxygen():
raise RuntimeError(f"Doxygen (>= 1.8.18) not found")