def get_repo(self, req): """ return the first repository in which the requirement matches at least one distribution """ for dist in self.iter_dists(req): return dist_naming.repo_dist(dist) return None
def get_matches_repo(self, req, repo): """ Return the set of distributions which match the requirement from a specified repository. """ matches = set() for dist, spec in self.index.iteritems(): if dist_naming.repo_dist(dist) == repo and req.matches(spec): matches.add(dist) return matches
def get_dist(self, req): """ return the distributions with the largest version and build number from the first repository which contains any matches """ repo = self.get_repo(req) if repo is None: return None matches = [] for dist in self.iter_dists(req): if dist_naming.repo_dist(dist) == repo: matches.append(dist) return max(matches, key=self.get_version_build)