diff --git a/pyreq2rpm/pyreq2rpm.py b/pyreq2rpm/pyreq2rpm.py index 95e9498..653b998 100644 --- a/pyreq2rpm/pyreq2rpm.py +++ b/pyreq2rpm/pyreq2rpm.py @@ -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) diff --git a/tests/test_convert.py b/tests/test_convert.py index bd5cd76..263a8b1 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -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'), @@ -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'),