pypa/pip — Issue #368: pip install and pip search use different version comparisons
Author: iffy
Created: 2011-10-13 19:08:12+00:00
State: open

pip search uses distutils.version classes for version comparisons.
pip install uses pkg_resources.parse_version for version comparisons.

I think they should use the same comparison logic.

I've run into the problem hosting a company-internal project that changed from date-based versions to name-based versions:

v11.10
v11.ape

Assuming pip install used distutils.version sorting, v11.ape is the latest, but pkg_resources disagrees.

```python
$ python
Python 2.6.2 (r262:71600, Jul 21 2010, 16:50:37)
[GCC 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.version import LooseVersion
>>>
>>> raw_versions = ['11.09', '11.ace', '11.10', '11.banana']
>>> versions = map(LooseVersion, raw_versions)
>>> versions.sort()
>>> print versions
[LooseVersion ('11.09'), LooseVersion ('11.10'), LooseVersion ('11.ace'), LooseVersion ('11.banana')]
>>>
>>>
>>> from pkg_resources import parse_version
>>> versions = map(parse_version, raw_versions)
>>> versions.sort()
>>> print versions
[('00000011', '*ace', '*final'), ('00000011', '*banana', '*final'), ('00000011', '00000009', '*final'), ('00000011', '00000010', '*final')]
```