parse_version post-release tags do not work as expected

Create issue
Issue #208 duplicate
Guy Rozendorn created an issue

According to http://packages.python.org/distribute/setuptools.html?highlight=tag:

from pkg_resources import parse_version parse_version('2.1-rc2') < parse_version('2.1') False

but both setuptools 0.6c11 and 0.6c12dev_r88795 show that: In [7]: parse_version('2.1-rc2') < parse_version('2.1') Out[7]: True

So pkg_resources acts the opposite of what the documentation says.

Comments (11)

  1. Tarek Ziadé repo owner
    • changed status to open

    Yeah this is a bug in the code, as the documentation insists '-' is the marker for post releases

  2. Hanno Schlichting

    I just tried this with distribute 0.6.14:

    >>> parse_version('2.1-rc2')
    ('00000002', '00000001', '*c', '00000002', '*final')
    
    >>> parse_version('2.1')
    ('00000002', '00000001', '*final')
    
    >>> parse_version('2.1-rc2') < parse_version('2.1')
    True
    

    So this works for me.

  3. Hanno Schlichting

    Tried this on 0.6.15 and 0.6.16 and it also works as expected. So sorry, I cannot reproduce the issue.

  4. Guy Rozendorn reporter
    • changed status to open

    Hanno,

    According to the documentation, '-' is a marker for post releases. so "2.1.-rc1" should be newer to "2.1", so actually it doesn't work in all the versions you tried.

  5. Log in to comment