]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/conf.py: try to provide real jar path 60987/head
authorDrunkard Zhang <gongfan193@gmail.com>
Sat, 7 Dec 2024 03:38:48 +0000 (11:38 +0800)
committerDrunkard Zhang <gongfan193@gmail.com>
Sat, 7 Dec 2024 03:38:48 +0000 (11:38 +0800)
The path got by shutil.which is usually a hook, not real jar, so try to
provide real jar. And fallback to the hook detected when failed.

Signed-off-by: Drunkard Zhang <gongfan193@gmail.com>
doc/conf.py

index 4fdc9a53b757f56d717ab40c11212d26474f0d56..5293ff1b212601274aef972da178b2b4bd5dfec7 100644 (file)
@@ -76,7 +76,7 @@ html_show_sphinx = False
 html_static_path = ["_static"]
 html_sidebars = {
     '**': ['smarttoc.html', 'searchbox.html']
-    }
+}
 
 html_css_files = ['css/custom.css']
 
@@ -133,13 +133,23 @@ extensions = [
     'sphinxcontrib.mermaid',
     'sphinxcontrib.openapi',
     'sphinxcontrib.seqdiag',
-    ]
+]
 
 ditaa = shutil.which("ditaa")
 if ditaa is not None:
     # in case we don't have binfmt_misc enabled or jar is not registered
-    ditaa_args = ['-jar', ditaa]
-    ditaa = 'java'
+    _jar_paths = [
+        '/usr/share/ditaa/lib/ditaa.jar',  # Gentoo
+        '/usr/share/ditaa/ditaa.jar',  # deb
+        '/usr/share/java/ditaa.jar',  # rpm
+    ]
+    _jar_paths = [p for p in _jar_paths if os.path.exists(p)]
+    if _jar_paths:
+        ditaa = 'java'
+        ditaa_args = ['-jar', _jar_paths[0]]
+    else:
+        # keep ditaa from shutil.which
+        ditaa_args = []
     extensions += ['sphinxcontrib.ditaa']
 else:
     extensions += ['plantweb.directive']