diff options
author | Hui Li <herdingcat@yahoo.com> | 2021-10-29 08:55:33 -0700 |
---|---|---|
committer | Hui Li <herdingcat@yahoo.com> | 2021-10-29 08:55:33 -0700 |
commit | da78c54b2fdf1140dfa1438172183473deb30d96 (patch) | |
tree | e12d2d16d59335945a9c66753f3889d0ea8792b4 | |
parent | e02896c5da8f56c139b1a3ecfd68d72336ca7727 (diff) | |
download | mcelog-da78c54b2fdf1140dfa1438172183473deb30d96.tar.gz |
fix python errors in genconfig.py
Signed-off-by: Hui Li <herdingcat@yahoo.com>
-rwxr-xr-x | genconfig.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/genconfig.py b/genconfig.py index f7faa92..87094e8 100755 --- a/genconfig.py +++ b/genconfig.py @@ -3,7 +3,6 @@ # genconfig.py mcelog.conf intro.html import sys import re -import string import argparse ap = argparse.ArgumentParser(description="generate man config documentation from mcelog.conf example") @@ -30,12 +29,12 @@ def parse(f): explanation += 1 s = m.group(1) if explanation == 1: - s = string.capitalize(s) - print s + s = s.capitalize() + print(s) continue if explanation: - print ".PP" + print(".PP") explanation = 0 # empty line: new option @@ -52,29 +51,29 @@ def parse(f): if m: config_option(m.group(1), m.group(2), m.group(3)) continue - print >>sys.stderr, "Unparseable line %d" % (lineno-1) + print("Unparseable line %d" % (lineno-1), file=sys.stderr, flush=True) def config_option(enabled, name, value): - print ".B %s = %s" % (name, value) - print ".PP" + print(".B %s = %s" % (name, value)) + print(".PP") def start_group(name): - print ".SS \"The %s config section\"" % (name) + print(".SS \"The %s config section\"" % (name)) def new_option(): - print ".PP" + print(".PP") -print """ +print(""" .\\" Auto generated mcelog.conf manpage. Do not edit. .TH "mcelog.conf" 5 "mcelog" -""" +""") -print args.intro.read() +print(args.intro.read()) parse(args.config) -print """ +print(""" .SH SEE ALSO .BR mcelog (8), .BR mcelog.triggers (5) .B http://www.mcelog.org -""" +""") |