Skip to content

Unreasonable comparisons #320

@torsava

Description

@torsava

Hi,
we have found that packaging evaluates some comparisons unreasonably / illogically.

I'll use this format:

(version, operator, version, comparison_evaluation),

For these comparisons, packaging ignores equality and evaluates as if the operator was simply <:

('2.4.8', '<=', '2.4.8.*', False),
('2.4.8.0', '<=', '2.4.8.*', False),
('2.4.8.1', '<=', '2.4.8.*', False),
('2.4.8.post1', '<=', '2.4.8.*', False),

And in this set, also the > operator is evaluated wrong:

('2.4.8', '>', '2.4.8.*', True),
('2.4.8.0', '>', '2.4.8.*', True),
('2.4.8.1', '>', '2.4.8.*', True),
('2.4.8b5', '>', '2.4.8.*', True),
('2.4.8.post1', '>', '2.4.8.*', True),

Both these comparisons are undefined according to PEP 440. However, as someone will surely be using them, tests have been added for them in the Python-to-RPM-version project pyreq2rpm, see PR gordonmessmer/pyreq2rpm#7.

The tests currently verify that the comparisons are consistent with this illlogical upstream behaviour. But of course, an even better solution would be to fix the behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions