Sync python dependency conversion with pyreq2rpm.

This commit is contained in:
Gordon Messmer 2020-07-03 22:38:41 -07:00 committed by Tomas Orsava
parent 7398b71fbc
commit fbe1c77166
2 changed files with 8 additions and 5 deletions

View File

@ -49,6 +49,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py
%changelog
* Tue Jul 21 2020 Miro Hrončok <mhroncok@redhat.com> - 11-10
- pythondistdeps: Split Python Extras names after the rightmost plus sign
- pythondistdeps: Handle edge cases of version comparisons more closely to
upstream, despite irrationality
See: https://github.com/pypa/packaging/issues/320
* Fri Jul 10 2020 Tomas Orsava <torsava@redhat.com> - 11-9
- pythondistdeps: Implement provides/requires for extras packages

View File

@ -115,12 +115,12 @@ def convert_ordered(name, operator, version_id):
# with ordered comparisons
version_id = version_id[:-2]
version = RpmVersion(version_id)
if '>' == operator:
# distutils does not behave this way, but this is
# their recommendation
# https://mail.python.org/archives/list/distutils-sig@python.org/thread/NWEQVTCX5CR2RKW2LT4H77PJTEINSX7P/
if operator == '>':
# distutils will allow a prefix match with '>'
operator = '>='
version.increment()
if operator == '<=':
# distutils will not allow a prefix match with '<='
operator = '<'
else:
version = RpmVersion(version_id)
return '{} {} {}'.format(name, operator, version)