contrib/check-config.py
changeset 39708 fe28267d5223
parent 35920 2912bed9b0c7
child 40259 5519697b71b3
equal deleted inserted replaced
39707:5abc47d4ca6b 39708:fe28267d5223
   102             m = configre.search(line) or configwithre.search(line)
   102             m = configre.search(line) or configwithre.search(line)
   103             if m:
   103             if m:
   104                 ctype = m.group('ctype')
   104                 ctype = m.group('ctype')
   105                 if not ctype:
   105                 if not ctype:
   106                     ctype = 'str'
   106                     ctype = 'str'
   107                 name = m.group('section') + "." + m.group('option')
   107                 name = m.group('section') + b"." + m.group('option')
   108                 default = m.group('default')
   108                 default = m.group('default')
   109                 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
   109                 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
   110                     default = ''
   110                     default = b''
   111                 if re.match(b'[a-z.]+$', default):
   111                 if re.match(b'[a-z.]+$', default):
   112                     default = '<variable>'
   112                     default = b'<variable>'
   113                 if (name in foundopts and (ctype, default) != foundopts[name]
   113                 if (name in foundopts and (ctype, default) != foundopts[name]
   114                     and name not in allowinconsistent):
   114                     and name not in allowinconsistent):
   115                     print(l.rstrip())
   115                     print(l.rstrip())
   116                     print("conflict on %s: %r != %r" % (name, (ctype, default),
   116                     print("conflict on %s: %r != %r" % (name, (ctype, default),
   117                                                         foundopts[name]))
   117                                                         foundopts[name]))
   118                     print("at %s:%d:" % (f, linenum))
   118                     print("at %s:%d:" % (f, linenum))
   119                 foundopts[name] = (ctype, default)
   119                 foundopts[name] = (ctype, default)
   120                 carryover = ''
   120                 carryover = b''
   121             else:
   121             else:
   122                 m = re.search(configpartialre, line)
   122                 m = re.search(configpartialre, line)
   123                 if m:
   123                 if m:
   124                     carryover = line
   124                     carryover = line
   125                 else:
   125                 else:
   126                     carryover = ''
   126                     carryover = b''
   127 
   127 
   128     for name in sorted(foundopts):
   128     for name in sorted(foundopts):
   129         if name not in documented:
   129         if name not in documented:
   130             if not (name.startswith("devel.") or
   130             if not (name.startswith(b"devel.") or
   131                     name.startswith("experimental.") or
   131                     name.startswith(b"experimental.") or
   132                     name.startswith("debug.")):
   132                     name.startswith(b"debug.")):
   133                 ctype, default = foundopts[name]
   133                 ctype, default = foundopts[name]
   134                 if default:
   134                 if default:
   135                     default = ' [%s]' % default
   135                     default = ' [%s]' % default
   136                 print("undocumented: %s (%s)%s" % (name, ctype, default))
   136                 print("undocumented: %s (%s)%s" % (name, ctype, default))
   137 
   137