Search for repositories with GNU find

    Args:
        where (str): path to search from
        ignore_error (bool): if False, raise Exception when the returncode is
            not zero.

    Yields:
        Repository subclass instance

def find_find_repos(where, ignore_error=True):
    """
    Search for repositories with GNU find

    Args:
        where (str): path to search from
        ignore_error (bool): if False, raise Exception when the returncode is
            not zero.

    Yields:
        Repository subclass instance
    """
    log.debug(('REPO_REGEX', REPO_REGEX))
    FIND_REPO_REGEXCMD = ("-regex", '.*(%s)$' % REPO_REGEX)
    if os.uname()[0] == 'Darwin':
        cmd = ("find",
               '-E',
               '-L',  # dereference symlinks
               where,
               FIND_REPO_REGEXCMD[0],
               FIND_REPO_REGEXCMD[1])
    else:
        cmd = ("find",
               '-O3',
               '-L',  # dereference symlinks
               where,  # " .",
               "-regextype","posix-egrep",
               FIND_REPO_REGEXCMD[0],
               FIND_REPO_REGEXCMD[1])
    _cmd = ' '.join(cmd)
    log.debug("find_find_repos(%r) = %s" % (where, _cmd))
    kwargs = {
        #'shell': True,
        'cwd': where,
        'stderr': sys.stderr,
        'stdout': subprocess.PIPE,}
    p = subprocess.Popen(cmd, universal_newlines=True, **kwargs)
    if p.returncode and not ignore_error:
        p_stdout = p.communicate()[0]
        raise Exception("Subprocess return code: %d\n%r\n%r" % (
            p.returncode, cmd, p_stdout))

    for l in iter(p.stdout.readline, ''):
        path = l.rstrip()
        _path, _prefix = os.path.dirname(path), os.path.basename(path)
        repo = REPO_PREFIXES.get(_prefix)
        if repo is None:
            log.error("repo for path %r and prefix %r is None" %
                      (path, _prefix))
        if repo:
            yield repo(_path)