

def read_config(config_path):
    cfg = DefaultConfigParser()
    with open(config_path) as f:
        if hasattr(cfg, 'read_file'):
            cfg.read_file(f)
        else:
            cfg.readfp(f)
    current_dir = os.path.dirname(config_path)
    includes = []

    def _scan(filename, includes):
        if (os.path.abspath(filename) != filename):
            filename = os.path.join(current_dir, filename)
        paths = glob.glob(filename)
        if (paths == []):
            logger.warn(('%r does not lead to any config. Make sure include paths are relative to the main config file' % filename))
        includes += paths
    for include_file in cfg.dget('circus', 'include', '').split():
        _scan(include_file, includes)
    for include_dir in cfg.dget('circus', 'include_dir', '').split():
        _scan(os.path.join(include_dir, '*.ini'), includes)
    logger.debug(('Reading config files: %s' % includes))
    return (include_dir, ([config_path] + cfg.read(includes)))

dataset/ETHPy150Open circus-tent/circus/circus/config.py read_config/VarMisuse@228/330 `cfg`->`include_dir`