[gi-docgen/issue-88] config: Handle missing dot




commit 2420f1a2d648e2711e34c59a362a5dc7a9736f56
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat May 22 19:33:14 2021 +0100

    config: Handle missing dot
    
    If 'dot' is not available there's no point in checking the
    show_class_hierarchy configuration key: we know it won't work.
    
    Fixes: #88

 gidocgen/config.py     | 4 +++-
 gidocgen/gdgenerate.py | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gidocgen/config.py b/gidocgen/config.py
index 66bb020..eba2caf 100644
--- a/gidocgen/config.py
+++ b/gidocgen/config.py
@@ -6,7 +6,7 @@ import toml
 
 from urllib.parse import urljoin
 
-from . import log
+from . import log, utils
 
 
 class GIDocConfig:
@@ -138,6 +138,8 @@ class GIDocConfig:
 
     @property
     def show_class_hierarchy(self):
+        if utils.find_program('dot') is None:
+            return False
         return self.theme.get('show_class_hierarchy', False)
 
     def source_link(self, *args):
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 3d1ab75..8427ad0 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -1613,7 +1613,7 @@ def _gen_classes(config, theme_config, output_dir, jinja_env, repository, all_cl
         tmpl = TemplateClass(namespace, cls)
         template_classes.append(tmpl)
 
-        if config.show_class_hierarchy and utils.find_program('dot') is not None:
+        if config.show_class_hierarchy:
             tmpl.hierarchy_svg = utils.render_dot(tmpl.dot, output_format="svg")
 
         with open(class_file, "w") as out:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]