From 873d3bc34c704fae8732c1ebefa48098b68eb86d Mon Sep 17 00:00:00 2001 From: Miguel Araujo Perez Date: Wed, 13 Jul 2011 15:36:49 +0200 Subject: [PATCH] Checking requirements before adding them to installations --- pip/commands/outdated.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pip/commands/outdated.py b/pip/commands/outdated.py index 3b3f91c0a..e2ee60ecd 100644 --- a/pip/commands/outdated.py +++ b/pip/commands/outdated.py @@ -90,6 +90,7 @@ class OutdatedCommand(Command): for dist in get_installed_distributions(local_only=local_only): req = InstallRequirement.from_line(dist.key, None) + req.check_if_exists() installations[req.name] = req finder = self._build_package_finder(options, index_urls) @@ -98,6 +99,10 @@ class OutdatedCommand(Command): for req in installations.values(): try: link = finder.find_requirement(req, True) + + # If link is None, means installed version is most up-to-date + if link is None: + continue except DistributionNotFound: continue @@ -105,11 +110,8 @@ class OutdatedCommand(Command): # that returned version remote_version = finder._link_package_versions(link, req.name)[0][2] - req.check_if_exists() - installed_version = req.installed_version - - if remote_version > installed_version: - logger.notify('%s (CURRENT: %s LATEST: %s)' % (str(req), installed_version, remote_version)) + if remote_version > req.installed_version: + logger.notify('%s (CURRENT: %s LATEST: %s)' % (str(req), req.installed_version, remote_version)) OutdatedCommand()