From a027cebf0847e96fc5721c25a13019c0f0f5e9fd Mon Sep 17 00:00:00 2001
From: Antoine Lambert <anlambert@softwareheritage.org>
Date: Thu, 27 Apr 2023 17:00:30 +0200
Subject: [PATCH] sphinx/conf.py: Filter out swh-webhooks doc in
 set_django_settings

swh-webhooks package is detected as swh-web by the code of that function
but django is not installed when building standalone doc for this package.
---
 swh/docs/sphinx/conf.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/swh/docs/sphinx/conf.py b/swh/docs/sphinx/conf.py
index 17ca69b2..244bd231 100755
--- a/swh/docs/sphinx/conf.py
+++ b/swh/docs/sphinx/conf.py
@@ -286,9 +286,14 @@ class SimpleDocumenter(autodoc.FunctionDocumenter):
 # sphinx event handler to set adequate django settings prior reading
 # apidoc generated rst files when building doc to avoid autodoc errors
 def set_django_settings(app, env, docname):
-    if any([pattern in app.srcdir for pattern in ("swh-web-client", "DWCLI")]):
-        # swh-web-client is detected as swh-web by the code below but
-        # django is not installed when building standalone swh-web-client doc
+    if any(
+        [
+            pattern in app.srcdir
+            for pattern in ("swh-web-client", "DWCLI", "swh-webhooks")
+        ]
+    ):
+        # swh-web-client and swh-webhooks are detected as swh-web by the code below
+        # but django is not installed when building standalone doc for these packages
         return
     package_settings = {
         "auth": "swh.auth.tests.django.app.apptest.settings",
-- 
GitLab