Skip to content

Commit a54f571

Browse files
committed
doc/conf.py: try to provide real jar path
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 <[email protected]>
1 parent cf48fdd commit a54f571

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

doc/conf.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def is_release_eol(codename):
7676
html_static_path = ["_static"]
7777
html_sidebars = {
7878
'**': ['smarttoc.html', 'searchbox.html']
79-
}
79+
}
8080

8181
html_css_files = ['css/custom.css']
8282

@@ -133,13 +133,23 @@ def is_release_eol(codename):
133133
'sphinxcontrib.mermaid',
134134
'sphinxcontrib.openapi',
135135
'sphinxcontrib.seqdiag',
136-
]
136+
]
137137

138138
ditaa = shutil.which("ditaa")
139139
if ditaa is not None:
140140
# in case we don't have binfmt_misc enabled or jar is not registered
141-
ditaa_args = ['-jar', ditaa]
142-
ditaa = 'java'
141+
_jar_paths = [
142+
'/usr/share/ditaa/lib/ditaa.jar', # Gentoo
143+
'/usr/share/ditaa/ditaa.jar', # deb
144+
'/usr/share/java/ditaa.jar', # rpm
145+
]
146+
_jar_paths = [p for p in _jar_paths if os.path.exists(p)]
147+
if _jar_paths:
148+
ditaa = 'java'
149+
ditaa_args = ['-jar', _jar_paths[0]]
150+
else:
151+
# keep ditaa from shutil.which
152+
ditaa_args = []
143153
extensions += ['sphinxcontrib.ditaa']
144154
else:
145155
extensions += ['plantweb.directive']

0 commit comments

Comments
 (0)