From fa65b06403889cb9dbdfece32726d6865030170a Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Tue, 14 Jan 2025 12:46:23 +0100
Subject: [PATCH] check for graphviz installation in noxfile

---
 noxfile.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/noxfile.py b/noxfile.py
index 121f4f575..6797b0687 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -25,7 +25,7 @@ def get_cuda_version(session: nox.Session) -> None | tuple[int, ...]:
             return tuple(int(v) for v in version_string.split("."))
         except ValueError:
             pass
-    
+
     session.warn("nvcc was found, but I am unable to determine the CUDA version.")
     return None
 
@@ -51,6 +51,17 @@ def install_cupy(
         session.install(cupy_package)
 
 
+def check_external_doc_dependencies(session: nox.Session):
+    dot_args = ["dot", "--version"]
+    try:
+        _ = subprocess.run(dot_args)
+    except FileNotFoundError:
+        session.error(
+            "Unable to build documentation: "
+            "command `dot` from the `graphviz` package (https://www.graphviz.org/) could not be found."
+        )
+
+
 def editable_install(session: nox.Session, opts: Sequence[str] = ()):
     if opts:
         opts_str = "[" + ",".join(opts) + "]"
@@ -105,6 +116,7 @@ def testsuite(session: nox.Session, cupy_version: str | None):
 @nox.session(python=["3.10"], tags=["docs"])
 def docs(session: nox.Session):
     """Build the documentation pages"""
+    check_external_doc_dependencies(session)
     install_cupy(session, "12.3")
     editable_install(session, ["doc"])
     session.chdir("docs")
-- 
GitLab