From 8e2d441dabc64b8a6d21dba431c4de8a559169dc Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Wed, 17 Dec 2014 23:54:58 -0800 Subject: [PATCH] Displays info about [un]installed versions Displays version when installing and uninstalling -- e.g.: Successfully installed pyrepl-0.8.4 pytest-2.6.4 and: Uninstalling pyrepl-0.8.4: Successfully uninstalled pyrepl-0.8.4 Uninstalling pytest-2.6.4: Successfully uninstalled pytest-2.6.4 --- pip/commands/install.py | 19 +++++++++++++++---- pip/req/req_uninstall.py | 8 ++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pip/commands/install.py b/pip/commands/install.py index 37a9da848..367bc594e 100644 --- a/pip/commands/install.py +++ b/pip/commands/install.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import logging +import operator import os import tempfile import shutil @@ -345,10 +346,20 @@ class InstallCommand(Command): global_options, root=options.root_path, ) - installed = ' '.join([ - req.name for req in - requirement_set.successfully_installed - ]) + reqs = sorted( + requirement_set.successfully_installed, + key=operator.attrgetter('name')) + items = [] + for req in reqs: + item = req.name + try: + if hasattr(req, 'installed_version'): + if req.installed_version: + item += '-' + req.installed_version + except Exception: + pass + items.append(item) + installed = ' '.join(items) if installed: logger.info('Successfully installed %s', installed) else: diff --git a/pip/req/req_uninstall.py b/pip/req/req_uninstall.py index c133b235c..259e1c6fd 100644 --- a/pip/req/req_uninstall.py +++ b/pip/req/req_uninstall.py @@ -98,7 +98,10 @@ class UninstallPathSet(object): self.dist.project_name, ) return - logger.info('Uninstalling %s:', self.dist.project_name) + logger.info( + 'Uninstalling %s-%s:', + self.dist.project_name, self.dist.version + ) with indent_log(): paths = sorted(self.compact(self.paths)) @@ -124,7 +127,8 @@ class UninstallPathSet(object): for pth in self.pth.values(): pth.remove() logger.info( - 'Successfully uninstalled %s', self.dist.project_name + 'Successfully uninstalled %s-%s', + self.dist.project_name, self.dist.version ) def rollback(self):