def _find_cached_dep(self, name, display_name, kwargs):
    for_machine = self.machine_from_native_kwarg(kwargs)
    identifier = dependencies.get_dep_identifier(name, kwargs)
    wanted_vers = mesonlib.stringlistify(kwargs.get('version', []))
    override = self.build.dependency_overrides[for_machine].get(identifier)
    if override:
        info = [mlog.blue(('(overridden)' if override.explicit else '(cached)'))]
        cached_dep = override.dep
        if (not cached_dep.found()):
            mlog.log('Dependency', mlog.bold(display_name), 'found:', mlog.red('NO'), *info)
            return (identifier, cached_dep)
        found_vers = cached_dep.get_version()
        if (not self.check_version(wanted_vers, found_vers)):
            mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO'), 'found', mlog.normal_cyan(found_vers), 'but need:', mlog.bold(', '.join(["'{}'".format(e) for e in wanted_vers])), *info)
            return (identifier, NotFoundDependency(self.environment))
    else:
        info = [mlog.blue('(cached)')]
        cached_dep = self.coredata.deps[for_machine].get(identifier)
        if cached_dep:
            found_vers = cached_dep.get_version()
            if (not self.check_version(wanted_vers, found_vers)):
                return (identifier, None)
    if cached_dep:
        if found_vers:
            info = [mlog.normal_cyan(found_vers), *info]
        mlog.log('Dependency', mlog.bold(display_name), 'found:', mlog.green('YES'), *info)
        return (identifier, cached_dep)
    return (identifier, None)
def _find_cached_dep(self, name, display_name, kwargs):
    for_machine = self.machine_from_native_kwarg(kwargs)
    identifier = dependencies.get_dep_identifier(name, kwargs)
    wanted_vers = mesonlib.stringlistify(kwargs.get('version', []))
    override = self.build.dependency_overrides[for_machine].get(identifier)
    if override:
        info = [mlog.blue(('(overridden)' if override.explicit else '(cached)'))]
        cached_dep = override.dep
        if (not cached_dep.found()):
            mlog.log('Dependency', mlog.bold(display_name), 'found:', mlog.red('NO'), *info)
            return (identifier, cached_dep)
        found_vers = cached_dep.get_version()
        if (not self.check_version(wanted_vers, found_vers)):
            mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO'), 'found', mlog.normal_cyan(found_vers), 'but need:', mlog.bold(', '.join(["'{}'".format(e) for e in wanted_vers])), *info)
            return (identifier, NotFoundDependency(self.environment))
    else:
        info = [mlog.blue('(cached)')]
        cached_dep = self.coredata.deps[for_machine].get(identifier)
        if cached_dep:
            found_vers = cached_dep.get_version()
            if (not self.check_version(wanted_vers, found_vers)):
                return (identifier, None)
    if cached_dep:
        if found_vers:
            info = [mlog.normal_cyan(found_vers), *info]
        mlog.log('Dependency', mlog.bold(display_name), 'found:', mlog.green('YES'), *info)
        return (identifier, cached_dep)
    return (identifier, None)