Fix a regression with required legacy versions (e.g. pytz>dev)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2019954
This commit is contained in:
Miro Hrončok 2021-11-04 11:19:06 +01:00
parent a3ad67b505
commit 13ab465c04
4 changed files with 17 additions and 6 deletions

View File

@ -1,7 +1,7 @@
Name: python-rpm-generators
Summary: Dependency generators for Python RPMs
Version: 12
Release: 10%{?dist}
Release: 11%{?dist}
# Originally all those files were part of RPM, so license is kept here
License: GPLv2+
@ -47,6 +47,10 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py
%{_rpmconfigdir}/pythonbundles.py
%changelog
* Thu Nov 04 2021 Miro Hrončok <mhroncok@redhat.com> - 12-11
- Fix a regression with required legacy versions (e.g. pytz>dev)
- Fixes rhbz#2019954
* Fri Oct 29 2021 Gordon Messmer <gordon.messmer@gmail.com> - 12-10
- Additional fix for dev releases.

View File

@ -236,11 +236,15 @@ def convert_ordered(name, operator, version_id):
else:
version = RpmVersion(version_id)
# Prevent dev and pre-releases from satisfying a < requirement
if operator == '<' and not version.pre and not version.dev and not version.post:
version = '{}~~'.format(version)
# Prevent post-releases from satisfying a > requirement
if operator == '>' and not version.pre and not version.dev and not version.post:
version = '{}.0'.format(version)
try:
# For backwards compatibility, fallback to previous behavior with LegacyVersions
if operator == '<' and not version.pre and not version.dev and not version.post:
version = '{}~~'.format(version)
# Prevent post-releases from satisfying a > requirement
if operator == '>' and not version.pre and not version.dev and not version.post:
version = '{}.0'.format(version)
except AttributeError:
pass
return '{} {} {}'.format(name, operator, version)

View File

@ -102,3 +102,5 @@ test___multiple__underscores==1
test_underscores==1
dnspython[DNSSEC]
legacy>dev

View File

@ -1312,6 +1312,7 @@
(python3.9dist(hugo3) < 11.1.1~b14 or python3.9dist(hugo3) > 11.1.1~b14)
python3.9dist(hugo4) > 11~rc0
python3.9dist(hugo5) = 11.1^post3
python3.9dist(legacy) > dev
python3.9dist(pyparsing0)
((python3.9dist(pyparsing1) < 2.0.4 or python3.9dist(pyparsing1) > 2.0.4) with (python3.9dist(pyparsing1) < 2.1.2 or python3.9dist(pyparsing1) > 2.1.2) with (python3.9dist(pyparsing1) < 2.1.6 or python3.9dist(pyparsing1) > 2.1.6) with python3.9dist(pyparsing1) >= 2.0.1)
python3.9dist(test-multiple-underscores) = 1