def find_config(test_file=None, defaults=None, root=os.curdir):
    """
    Find the path to the default config file.

    We look at :root: for the :default: config file. If we can't find it
    there we start looking at the parent directory recursively until we
    find a file named :default: and return the absolute path to it.
    If we can't find anything, we return None.

    Args:
        default: The name of the config file we look for.
        root: The directory to start looking for.

    Returns:
        Path to the default config file, None if we can't find anything.
    """
    if defaults is None:
        defaults = [".benchbuild.yml", ".benchbuild.yaml"]

    def walk_rec(cur_path, root):
        cur_path = local.path(root) / test_file
        if cur_path.exists():
            return cur_path

        new_root = local.path(root) / os.pardir
        return walk_rec(cur_path, new_root) if new_root != root else None

    if test_file is not None:
        return walk_rec(test_file, root)

    for test_file in defaults:
        ret = walk_rec(test_file, root)
        if ret is not None:
            return ret
def find_config ( test_file = None , defaults = None , root = os . curdir ) : if defaults is None : defaults = [ ".benchbuild.yml" , ".benchbuild.yaml" ] def walk_rec ( cur_path , root ) : cur_path = local . path ( root ) / test_file if cur_path . exists ( ) : return cur_path new_root = local . path ( root ) / os . pardir return walk_rec ( cur_path , new_root ) if new_root != root else None if test_file is not None : return walk_rec ( test_file , root ) for test_file in defaults : ret = walk_rec ( test_file , root ) if ret is not None : return ret
Find the path to the default config file.

    We look at :root: for the :default: config file. If we can't find it
    there we start looking at the parent directory recursively until we
    find a file named :default: and return the absolute path to it.
    If we can't find anything, we return None.

    Args:
        default: The name of the config file we look for.
        root: The directory to start looking for.

    Returns:
        Path to the default config file, None if we can't find anything.