Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document unreasonable legacy comparisons #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyreq2rpm/pyreq2rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ def convert_ordered(name, operator, version_id):
version = RpmVersion(version_id)
if operator == '>':
# distutils will allow a prefix match with '>'
# see: https://github.com/pypa/packaging/issues/320
operator = '>='
if operator == '<=':
# distutils will not allow a prefix match with '<='
# see: https://github.com/pypa/packaging/issues/320
operator = '<'
else:
version = RpmVersion(version_id)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def run_rpmbuild(dep):
(['foobar', '<=', '2.4.8'], 'foobar <= 2.4.8'),
(['foobar', '<=', '2.4.8.0'], 'foobar <= 2.4.8'),
(['foobar', '<=', '2.4.8.1'], 'foobar <= 2.4.8.1'),
(['foobar', '<=', '2.4.8.*'], 'foobar < 2.4.8'),
(['foobar', '<=', '2.4.8.*'], 'foobar < 2.4.8'), # Legacy not-yet-deprecated behaviour, see: https://github.com/pypa/packaging/issues/320
(['foobar', '<=', '2.0'], 'foobar <= 2'),
(['foobar', '<=', '2'], 'foobar <= 2'),
(['foobar', '<=', '2.*'], 'foobar < 2'),
(['foobar', '<=', '2.*'], 'foobar < 2'), # Legacy not-yet-deprecated behaviour, see: https://github.com/pypa/packaging/issues/320
(['foobar', '<=', '2.4.8b5'], 'foobar <= 2.4.8~b5'),
(['foobar', '<=', '2.0.0b5'], 'foobar <= 2~b5'),
(['foobar', '<=', '2.4.8.post1'], 'foobar <= 2.4.8^post1'),
Expand Down Expand Up @@ -97,10 +97,10 @@ def run_rpmbuild(dep):
(['foobar', '>', '2.4.8'], 'foobar > 2.4.8'),
(['foobar', '>', '2.4.8.0'], 'foobar > 2.4.8'),
(['foobar', '>', '2.4.8.1'], 'foobar > 2.4.8.1'),
(['foobar', '>', '2.4.8.*'], 'foobar >= 2.4.8'),
(['foobar', '>', '2.4.8.*'], 'foobar >= 2.4.8'), # Legacy not-yet-deprecated behaviour, see: https://github.com/pypa/packaging/issues/320
(['foobar', '>', '2.0'], 'foobar > 2'),
(['foobar', '>', '2'], 'foobar > 2'),
(['foobar', '>', '2.*'], 'foobar >= 2'),
(['foobar', '>', '2.*'], 'foobar >= 2'), # Legacy not-yet-deprecated behaviour, see: https://github.com/pypa/packaging/issues/320
(['foobar', '>', '2.4.8b5'], 'foobar > 2.4.8~b5'),
(['foobar', '>', '2.0.0b5'], 'foobar > 2~b5'),
(['foobar', '>', '2.4.8.post1'], 'foobar > 2.4.8^post1'),
Expand Down