##// END OF EJS Templates
contrib: fix up output in check-config.py to use strs to avoid b prefixes...
Augie Fackler -
r40295:5519697b default
parent child Browse files
Show More
@@ -42,6 +42,14 b" ignorere = re.compile(br'''"
42 42 config:\s(?P<config>\S+\.\S+)$
43 43 ''', re.VERBOSE | re.MULTILINE)
44 44
45 if sys.version_info[0] > 2:
46 def mkstr(b):
47 if isinstance(b, str):
48 return b
49 return b.decode('utf8')
50 else:
51 mkstr = lambda x: x
52
45 53 def main(args):
46 54 for f in args:
47 55 sect = b''
@@ -92,7 +100,7 b' def main(args):'
92 100 # look for ignore markers
93 101 m = ignorere.search(l)
94 102 if m:
95 if m.group('reason') == 'inconsistent':
103 if m.group('reason') == b'inconsistent':
96 104 allowinconsistent.add(m.group('config'))
97 105 else:
98 106 documented[m.group('config')] = 1
@@ -106,16 +114,20 b' def main(args):'
106 114 ctype = 'str'
107 115 name = m.group('section') + b"." + m.group('option')
108 116 default = m.group('default')
109 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
117 if default in (
118 None, b'False', b'None', b'0', b'[]', b'""', b"''"):
110 119 default = b''
111 120 if re.match(b'[a-z.]+$', default):
112 121 default = b'<variable>'
113 122 if (name in foundopts and (ctype, default) != foundopts[name]
114 123 and name not in allowinconsistent):
115 print(l.rstrip())
116 print("conflict on %s: %r != %r" % (name, (ctype, default),
117 foundopts[name]))
118 print("at %s:%d:" % (f, linenum))
124 print(mkstr(l.rstrip()))
125 fctype, fdefault = foundopts[name]
126 print("conflict on %s: %r != %r" % (
127 mkstr(name),
128 (mkstr(ctype), mkstr(default)),
129 (mkstr(fctype), mkstr(fdefault))))
130 print("at %s:%d:" % (mkstr(f), linenum))
119 131 foundopts[name] = (ctype, default)
120 132 carryover = b''
121 133 else:
@@ -132,8 +144,13 b' def main(args):'
132 144 name.startswith(b"debug.")):
133 145 ctype, default = foundopts[name]
134 146 if default:
147 if isinstance(default, bytes):
148 default = mkstr(default)
135 149 default = ' [%s]' % default
136 print("undocumented: %s (%s)%s" % (name, ctype, default))
150 elif isinstance(default, bytes):
151 default = mkstr(default)
152 print("undocumented: %s (%s)%s" % (
153 mkstr(name), mkstr(ctype), default))
137 154
138 155 if __name__ == "__main__":
139 156 if len(sys.argv) > 1:
@@ -59,6 +59,7 b' test-censor.t'
59 59 test-changelog-exec.t
60 60 test-check-code.t
61 61 test-check-commit.t
62 test-check-config.py
62 63 test-check-execute.t
63 64 test-check-interfaces.py
64 65 test-check-module-imports.t
General Comments 0
You need to be logged in to leave comments. Login now