utils.py
changeset 7865 eb55045524be
parent 7063 9f950840670b
equal deleted inserted replaced
7864:d0df2d56ae9c 7865:eb55045524be
    24 
    24 
    25         # Look for the list.
    25         # Look for the list.
    26         list_string = ""
    26         list_string = ""
    27         parsing_multiline_list = False
    27         parsing_multiline_list = False
    28         for line in file_in:
    28         for line in file_in:
       
    29 
       
    30             # Remove any comments.
       
    31             if '#' in line:
       
    32                 (line, comment) = line.split('#', 1)
       
    33 
       
    34             # Parse the line.
    29             if list_name in line or parsing_multiline_list:
    35             if list_name in line or parsing_multiline_list:
    30                 list_string += line
    36                 list_string += line
    31 
    37 
    32                 # Handle multiline lists.
    38                 # Handle multiline lists.
    33                 if ']' not in list_string:
    39                 if ']' not in list_string:
    58         file_in = open(file_path, "r")
    64         file_in = open(file_path, "r")
    59 
    65 
    60         # Look for the boolean variable.
    66         # Look for the boolean variable.
    61         bool_found = False
    67         bool_found = False
    62         for line in file_in:
    68         for line in file_in:
       
    69 
       
    70             # Remove any comments.
       
    71             if '#' in line:
       
    72                 (line, comment) = line.split('#', 1)
       
    73 
       
    74             # Parse the line.
    63             if bool_name in line:
    75             if bool_name in line:
    64                 # Evaluate the variable's line once it is found.  Make
    76                 # Evaluate the variable's line once it is found.  Make
    65                 # the split function only split it once.
    77                 # the split function only split it once.
    66                 bool = eval(line.split('=', 1)[1].strip())
    78                 bool = eval(line.split('=', 1)[1].strip())
    67                 bool_found = True
    79                 bool_found = True