Skip to content
Merged
Changes from 1 commit
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
32 changes: 30 additions & 2 deletions obidog/wrappers/doxygen_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,33 @@
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 clang_format_exec:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it named clang_format_exec ?

version = clang_format_exec.stdout.read().decode("utf-8").strip()
try:
version = version.split()[0].split(".")
if int(version[0]) >= 1 and int(version[1]) >= 8:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.8.18 should be the minimum version due to certain issues with previous Doxygen versions

return True
else:
return False
except:
return False
except FileNotFoundError as e:
return False

def build_doxygen_documentation(source_path):
if DOXYGEN_PATH is None:
log.warn("doxygen not found, could not create doxygen files")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doxygen is mandatory, you can raise an Exception if it wasn't found

return ""

path = tempfile.mkdtemp()
src_directories = [
os.path.join(source_path, directory)
Expand All @@ -19,6 +43,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():
DOXYGEN_PATH = None