]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tools: pylint update-man-rules.py
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 17 Jul 2023 20:39:37 +0000 (22:39 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 10 Aug 2023 16:13:29 +0000 (18:13 +0200)
tools/update-man-rules.py

index 3a8c31dc358ab241c9a4a4c98ac6cc985fccf254..1c2c9a8f65924effdbf8bc9b39df1add131eb8fb 100755 (executable)
@@ -1,16 +1,17 @@
 #!/usr/bin/env python3
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
-from __future__ import print_function
 import collections
 import glob
+import pprint
 import sys
 from pathlib import Path
-import pprint
+
 from xml_helper import xml_parse
 
+
 def man(page, number):
-    return '{}.{}'.format(page, number)
+    return f'{page}.{number}'
 
 def add_rules(rules, name):
     xml = xml_parse(name)
@@ -60,7 +61,7 @@ MESON_FOOTER = '''\
 # Really, do not edit.
 '''
 
-def make_mesonfile(rules, dist_files):
+def make_mesonfile(rules, _dist_files):
     # reformat rules as
     # grouped = [ [name, section, [alias...], condition], ...]
     #
@@ -77,7 +78,7 @@ def make_mesonfile(rules, dist_files):
               for p, aliases in sorted(grouped.items()) ]
     return '\n'.join((MESON_HEADER, pprint.pformat(lines)[1:-1], MESON_FOOTER))
 
-if __name__ == '__main__':
+def main():
     source_glob = sys.argv[1]
     target = Path(sys.argv[2])
 
@@ -95,3 +96,6 @@ if __name__ == '__main__':
     tmp = target.with_suffix('.tmp')
     tmp.write_text(text)
     tmp.rename(target)
+
+if __name__ == '__main__':
+    main()