summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-20 13:15:44 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-20 13:15:44 +0200
commit198fda4f48c99511ad34e436293cfc31c1096056 (patch)
tree21f72eda62d857f72ea7562266ecf9e3a5595701
parent8aaf611b9a38b6687427d2d8109f5d36570ef8de (diff)
downloadsystemd-198fda4f48c99511ad34e436293cfc31c1096056.tar.gz
update-dbus-docs: skip test if python is too old
-rwxr-xr-xtools/update-dbus-docs.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/update-dbus-docs.py b/tools/update-dbus-docs.py
index 255d7e180f..14ae30f33c 100755
--- a/tools/update-dbus-docs.py
+++ b/tools/update-dbus-docs.py
@@ -5,7 +5,6 @@ import argparse
import collections
import sys
import os
-import shlex
import subprocess
import io
@@ -14,6 +13,11 @@ try:
except ModuleNotFoundError as e:
etree = e
+try:
+ from shlex import join as shlex_join
+except ImportError as e:
+ shlex_join = e
+
class NoCommand(Exception):
pass
@@ -183,7 +187,7 @@ def subst_output(document, programlisting, stats):
interface = programlisting.get('interface')
argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}']
- print(f'COMMAND: {shlex.join(argv)}')
+ print(f'COMMAND: {shlex_join(argv)}')
try:
out = subprocess.check_output(argv, text=True)
@@ -293,9 +297,10 @@ def parse_args():
if __name__ == '__main__':
opts = parse_args()
- if isinstance(etree, Exception):
- print(etree, file=sys.stderr)
- exit(77 if opts.test else 1)
+ for item in (etree, shlex_join):
+ if isinstance(item, Exception):
+ print(item, file=sys.stderr)
+ exit(77 if opts.test else 1)
if not os.path.exists(f'{opts.build_dir}/systemd'):
exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.")