'Scan the path for distributions and populate the cache with
those that are found.'

def _generate_cache(self):

    gen_dist = (not self._cache.generated)
    gen_egg = (self._include_egg and (not self._cache_egg.generated))
    if (gen_dist or gen_egg):
        for dist in self._yield_distributions():
            if isinstance(dist, InstalledDistribution):
                self._cache.add(dist)
            else:
                self._cache_egg.add(dist)
        if gen_dist:
            self._cache.generated = True
        if gen_egg:
            self._cache_egg.generated = True
