def read_section(config, spec, section, name, global_section='apps'):
    """read in a section to a list, and stop when we hit the next section
    """
    members = []
    while True:
        if len(spec) == 0:
            break
        next_line = spec[0]
        if next_line.upper().strip().startswith('%'):
            break
        else:
            new_member = spec.pop(0)
            if not new_member.strip().startswith('#'):
                if section in ['applabels', 'appfiles', 'appenv']:
                    new_member = new_member.strip()
                members.append(new_member)
    if len(members) > 0:
        if section is not None and name is not None:
            config[global_section][name][section] = members
        else:
            config[global_section] = members
    return config
