osupython / pip2

Experimental port of pip from distutils to distutils2.
http://pip2.readthedocs.org/
MIT License
18 stars 11 forks source link

Search should return latest_version as a string #75

Closed njwilson closed 12 years ago

njwilson commented 12 years ago

When the search command finds a result that matches a project that is already installed, it adds 'installed_version' and 'latest_version' keys to the results.

'installed_version' gives a string representing the version (e.g., '0.1.1'), but 'latest_version' gives an object like NormalizedVersion('0.1.1'). These should be consistent. I suggest turning 'latest_version' into a string.

Here's an example that shows the issue:

>>> from pip2.commands.search import search
>>> import pprint
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(search('towel'))
{   'TowelStuff': {   'installed_version': '0.1.1',
                      'latest_version': NormalizedVersion('0.1.1'),
                      'summary': 'Useful towel-related stuff.'},
    'deczoTowelStuff': {'summary': 'UNKNOWN'},
    'figs': {'summary': 'A towel wrapped ConfigParser API.'},
    'towel': {'summary': 'Keeping you DRY since 2010'}}