[Catalog-sig] setuptools/distribute/easy_install/pkg_resource sorting algorithm

PJ Eby pje at telecommunity.com
Tue Mar 12 22:26:22 CET 2013

On Tue, Mar 12, 2013 at 3:59 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> On 12.03.2013 19:15, M.-A. Lemburg wrote:
>> I've run into a weird issue with easy_install, that I'm trying to solve:
>> If I place two files named
>> egenix_mxodbc_connect_client-2.0.2-py2.6.egg
>> egenix-mxodbc-connect-client-2.0.2.win32-py2.6.prebuilt.zip
>> into the same directory and let easy_install running on Linux
>> scan this, it considers the second file for Windows as best
>> match.
>> Is the algorithm used for determining the best match documented
>> somewhere ?
>> I've had a look at the implementation, but this left me rather
>> clueless.
>> I thought that setuptools would prefer the .egg file over
>> the prebuilt .zip file - binary files being easier to install
>> than "source" files.
> After some experiments, I found that the follow change
> in filename (swapping platform and python version, in addition
> to use '-' instead of '.) works:
> egenix-mxodbc-connect-client-2.0.2-py2.6-win32.prebuilt.zip
> OTOH, this one doesn't (notice the difference ?):
> egenix-mxodbc-connect-client-2.0.2.py2.6-win32.prebuilt.zip
> The logic behind all this looks rather fragile to me.

easy_install only guarantees sane version parsing for distribution
files built using setuptools' naming algorithms.  If you use
distutils, it can only make guesses, because the distutils does not
have a completely unambiguous file naming scheme.  And if you are
naming the files by hand, God help you.  ;-)

More information about the Catalog-SIG mailing list