summaryrefslogtreecommitdiff
path: root/scripts/asciidoc2html.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-07-02 14:58:11 +0200
committerFlorian Bruhin <me@the-compiler.org>2020-07-02 15:05:01 +0200
commit01db8cfb69219a9283949e88c43a229b31cd4b0c (patch)
tree2195220748fd0f597af3977e40032e1e34ab6bb6 /scripts/asciidoc2html.py
parent68b245aa6f7143fe1e44ebe67bed6e317a9dc81b (diff)
downloadqutebrowser-01db8cfb69219a9283949e88c43a229b31cd4b0c.tar.gz
qutebrowser-01db8cfb69219a9283949e88c43a229b31cd4b0c.zip
scripts: Clean up finding asciidoc in asciidoc2html
I've also tried to add asciidoc3 support, but with its asciidoc3.conf and asciidoc3_postinstall which creates ~/asciidoc3 (!) it doesn't really seem like a drop-in replacement.
Diffstat (limited to 'scripts/asciidoc2html.py')
-rwxr-xr-xscripts/asciidoc2html.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py
index e337c54db..f89ce86f9 100755
--- a/scripts/asciidoc2html.py
+++ b/scripts/asciidoc2html.py
@@ -218,21 +218,16 @@ class AsciiDoc:
if self._asciidoc is not None:
return self._asciidoc
- try:
- subprocess.run(['asciidoc'], stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL, check=True)
- except OSError:
- pass
- else:
- return ['asciidoc']
-
- try:
- subprocess.run(['asciidoc.py'], stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL, check=True)
- except OSError:
- pass
- else:
- return ['asciidoc.py']
+ for executable in ['asciidoc', 'asciidoc.py']:
+ try:
+ subprocess.run([executable, '--version'],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ check=True)
+ except OSError:
+ pass
+ else:
+ return [executable]
raise FileNotFoundError