]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "tools: make update-dbus-docs compatible with Python 3.7"
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Feb 2026 11:40:24 +0000 (20:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 18 Feb 2026 09:47:15 +0000 (18:47 +0900)
This reverts commit 668b3a42fe9e250912bd3efa4460ed691452d9bf.

Now we require Python 3.9 or newer.

tools/update-dbus-docs.py

index 8e4ab62569a3d2361cea74b547d0323e5b0920af..99c3db574498df74b126baa72f6bac430914e4cc 100755 (executable)
@@ -19,11 +19,6 @@ try:
 except ImportError as e:
     shlex_join = e
 
-try:
-    from shlex import quote as shlex_quote
-except ImportError as e:
-    shlex_quote = e
-
 class NoCommand(Exception):
     pass
 
@@ -214,10 +209,7 @@ def subst_output(document, programlisting, stats, missing_version):
     interface = programlisting.get('interface')
 
     argv = [f'{arguments.build_dir}/{executable}', f'--bus-introspect={interface}']
-    if isinstance(shlex_join, Exception):
-        print(f'COMMAND: {" ".join(shlex_quote(arg) for arg in argv)}')
-    else:
-        print(f'COMMAND: {shlex_join(argv)}')
+    print(f'COMMAND: {shlex_join(argv)}')
 
     try:
         out = subprocess.check_output(argv, universal_newlines=True)
@@ -326,7 +318,7 @@ def main():
     global arguments
     arguments = parse_args()
 
-    for item in (etree, shlex_quote):
+    for item in (etree, shlex_join):
         if isinstance(item, Exception):
             print(item, file=sys.stderr)
             sys.exit(77 if arguments.test else 1)
@@ -348,7 +340,7 @@ def main():
 
     # Let's print all statistics at the end
     mlen = max(len(page) for page in stats)
-    total = sum((item['stats'] for item in stats.values()), collections.Counter())
+    total = sum((item['stats'] for item in stats.values()), start=collections.Counter())
     total = 'total', { "stats" : total, "modified" : False }
     modified = []
     classification = 'OUTDATED' if arguments.test else 'MODIFIED'