From 39c24740d878afd3374742648ac847abc18a33ad Mon Sep 17 00:00:00 2001 From: Xavier Fernandez Date: Sun, 8 Mar 2015 18:20:09 +0100 Subject: [PATCH] move critical warning to find_requirement and away of _find_all_versions that will return an empty list --- pip/index.py | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/pip/index.py b/pip/index.py index 32f73e2d4..f80a4df5b 100644 --- a/pip/index.py +++ b/pip/index.py @@ -379,10 +379,28 @@ class PackageFinder(object): req.name.lower() ) ) - if (not find_links_versions and not - page_versions and not - dependency_versions and not - file_versions): + if file_versions: + file_versions.sort(reverse=True) + logger.debug( + 'Local files found: %s', + ', '.join([ + url_to_path(candidate.location.url) + for candidate in file_versions + ]) + ) + + # This is an intentional priority ordering + return ( + file_versions + find_links_versions + page_versions + + dependency_versions + ) + + def find_requirement(self, req, upgrade): + """Expects req, an InstallRequirement and upgrade, a boolean + Returns an InstallationCandidate or None + May raise DistributionNotFound or BestVersionAlreadyInstalled""" + all_versions = self._find_all_versions(req) + if not all_versions: logger.critical( 'Could not find any downloads that satisfy the requirement %s', req, @@ -406,27 +424,6 @@ class PackageFinder(object): raise DistributionNotFound( 'No distributions at all found for %s' % req ) - if file_versions: - file_versions.sort(reverse=True) - logger.debug( - 'Local files found: %s', - ', '.join([ - url_to_path(candidate.location.url) - for candidate in file_versions - ]) - ) - - # This is an intentional priority ordering - return ( - file_versions + find_links_versions + page_versions + - dependency_versions - ) - - def find_requirement(self, req, upgrade): - """Expects req, an InstallRequirement and upgrade, a boolean - Returns an InstallationCandidate or None - May raise DistributionNotFound or BestVersionAlreadyInstalled""" - all_versions = self._find_all_versions(req) # Filter out anything which doesn't match our specifier _versions = set( req.specifier.filter(