diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index acc9d06..2af6e6d 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -5,7 +5,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 10 -Release: 1%{?dist} +Release: 2%{?dist} # Originally all those files were part of RPM, so license is kept here License: GPLv2+ @@ -49,6 +49,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondeps.sh pythondistdeps.py %{_rpmconfigdir}/pythondistdeps.py %changelog +* Fri Jan 03 2020 Miro Hrončok - 10-2 +- Fix more complicated requirement expressions by adding parenthesis + * Wed Jan 01 2020 Miro Hrončok - 10-1 - Handle version ending with ".*" (#1758141) - Handle compatible-release operator "~=" (#1758141) diff --git a/pythondistdeps.py b/pythondistdeps.py index 2572ac2..da5f1a0 100755 --- a/pythondistdeps.py +++ b/pythondistdeps.py @@ -253,7 +253,7 @@ for name in names: spec_list = [] for spec in py_deps[name]: if spec[0] == '!=': - spec_list.append('{n} < {v} or {n} >= {v}.0'.format(n=name, v=spec[1])) + spec_list.append('({n} < {v} or {n} >= {v}.0)'.format(n=name, v=spec[1])) elif spec[0] == '~=': # Parse the current version next_ver = parse_version(spec[1]).base_version.split('.') @@ -262,7 +262,7 @@ for name in names: # Increment the minor version next_ver[-1] = str(int(next_ver[-1]) + 1) next_ver = '.'.join(next_ver) - spec_list.append('{n} >= {v} with {n} < {vnext}'.format(n=name, v=spec[1], vnext=next_ver)) + spec_list.append('({n} >= {v} with {n} < {vnext})'.format(n=name, v=spec[1], vnext=next_ver)) elif spec[0] == '==' and spec[1].endswith('.*'): # Parse the current version next_ver = parse_version(spec[1]).base_version.split('.') @@ -272,7 +272,7 @@ for name in names: # Increment the minor version next_ver[-1] = str(int(next_ver[-1]) + 1) next_ver = '.'.join(next_ver) - spec_list.append('{n} >= {v} with {n} < {vnext}'.format(n=name, v=spec[1], vnext=next_ver)) + spec_list.append('({n} >= {v} with {n} < {vnext})'.format(n=name, v=spec[1], vnext=next_ver)) else: spec_list.append('{} {} {}'.format(name, spec[0], spec[1])) if len(spec_list) == 1: