contrib/check-config.py
changeset 32847 e5a6a540ae63
parent 28352 a92ee4d8a574
child 32848 485b8e87e244
equal deleted inserted replaced
32846:7c11869cf23a 32847:e5a6a540ae63
    12 import sys
    12 import sys
    13 
    13 
    14 foundopts = {}
    14 foundopts = {}
    15 documented = {}
    15 documented = {}
    16 
    16 
    17 configre = (r"""ui\.config(|int|bool|list)\(['"](\S+)['"],\s*"""
    17 configre = re.compile(r'''
    18             r"""['"](\S+)['"](,\s+(?:default=)?(\S+?))?\)""")
    18     # Function call
       
    19     ui\.config(|int|bool|list)\(
       
    20         # First argument.
       
    21         ['"](\S+)['"],\s*
       
    22         # Second argument
       
    23         ['"](\S+)['"](,\s+
       
    24         (?:default=)?(\S+?))?
       
    25     \)''', re.VERBOSE | re.MULTILINE)
       
    26 
    19 configpartialre = (r"""ui\.config""")
    27 configpartialre = (r"""ui\.config""")
    20 
    28 
    21 def main(args):
    29 def main(args):
    22     for f in args:
    30     for f in args:
    23         sect = ''
    31         sect = ''
    69             if m:
    77             if m:
    70                 documented[m.group(1)] = 1
    78                 documented[m.group(1)] = 1
    71 
    79 
    72             # look for code-like bits
    80             # look for code-like bits
    73             line = carryover + l
    81             line = carryover + l
    74             m = re.search(configre, line, re.MULTILINE)
    82             m = configre.search(line)
    75             if m:
    83             if m:
    76                 ctype = m.group(1)
    84                 ctype = m.group(1)
    77                 if not ctype:
    85                 if not ctype:
    78                     ctype = 'str'
    86                     ctype = 'str'
    79                 name = m.group(2) + "." + m.group(3)
    87                 name = m.group(2) + "." + m.group(3)