Skip to content

Commit

Permalink
Merge pull request #2221 from msabramo/display_installed_versions_2
Browse files Browse the repository at this point in the history
Displays info about [un]installed versions
  • Loading branch information
dstufft committed Dec 19, 2014
2 parents 4d7cdd7 + 8e2d441 commit bca8f91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
19 changes: 15 additions & 4 deletions pip/commands/install.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import logging
import operator
import os
import tempfile
import shutil
Expand Down Expand Up @@ -345,10 +346,20 @@ def run(self, options, args):
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:
Expand Down
8 changes: 6 additions & 2 deletions pip/req/req_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def remove(self, auto_confirm=False):
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))
Expand All @@ -124,7 +127,8 @@ def remove(self, auto_confirm=False):
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):
Expand Down

0 comments on commit bca8f91

Please sign in to comment.