On Jun 21, 2006, at 5:11 PM, Phillip J. Eby wrote:

> """Requirement strings basically consist of a distribution name, an  
> optional list of "options" (more on this in a moment), and a comma- 
> separated list of zero or more version conditions. Version  
> conditions basically specify ranges of valid versions, using  
> comparison operators. The version conditions you supply are sorted  
> into ascending version order, and then scanned left to right until  
> the package's version falls between a pair of > or >= and < or <=  
> conditions, or exactly matches a == or != condition."""

I don't think this is right. :)

If I have a collection of eggs like:

    /home/jim/tmp/dist:
    used 92 available 41345796
    -rw-rw-r--  1 jim jim   671 Jun 19 17:43 demoneeded-1.0-py2.4.egg
    -rw-rw-r--  1 jim jim   672 Jun 19 17:46 demoneeded-1.1-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.2-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.3-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.4-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.5-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.6-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.7-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.8-py2.4.egg
    -rw-rw-r--  1 jim jim   673 Jun 19 17:46 demoneeded-1.9-py2.4.egg

Then:

  >>> import pkg_resources
  >>> e = pkg_resources.Environment(['tmp/dist'])
  >>> ws = pkg_resources.WorkingSet()
 >>> ws.resolve([pkg_resources.Requirement.parse('demoneeded !=1.1,  
<1.4')], e)
[demoneeded 1.3 (/home/jim/tmp/dist/demoneeded-1.3-py2.4.egg)]

When scanning left to right, 1.9 matches !=1.1, so it should match and,
since it is the highest version, it should be returned.  Either your  
description
of the algorithm is incorrect or I'm misunderstanding it.

Jim

--
Jim Fulton                      mailto:[EMAIL PROTECTED]                Python 
Powered!
CTO                             (540) 361-1714                  
http://www.python.org
Zope Corporation        http://www.zope.com             http://www.zope.org



_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to