diff --git a/SOURCES/python.attr b/SOURCES/python.attr index a7381d6..7e8a14b 100644 --- a/SOURCES/python.attr +++ b/SOURCES/python.attr @@ -1,4 +1,4 @@ -%__python_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides +%__python_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides-versions @MAJORVER-PROVIDES-VERSIONS@ %__python_requires %{_rpmconfigdir}/pythondeps.sh --requires -%__python_path ^((/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]/.*))|(%{_bindir}/python[[:digit:]]\\.[[:digit:]]))$ +%__python_path ^((/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]/.*)|(%{_bindir}/python[[:digit:]]\\.[[:digit:]]))$ %__python_magic [Pp]ython.*(executable|byte-compiled) diff --git a/SOURCES/pythondistdeps.py b/SOURCES/pythondistdeps.py index 70fa0ea..176fe21 100755 --- a/SOURCES/pythondistdeps.py +++ b/SOURCES/pythondistdeps.py @@ -20,7 +20,7 @@ from warnings import warn opts, args = getopt( argv[1:], 'hPRrCEMmLl:', - ['help', 'provides', 'requires', 'recommends', 'conflicts', 'extras', 'majorver-provides', 'majorver-only', 'legacy-provides' , 'legacy']) + ['help', 'provides', 'requires', 'recommends', 'conflicts', 'extras', 'majorver-provides', 'majorver-provides-versions=', 'majorver-only', 'legacy-provides' , 'legacy']) Provides = False Requires = False @@ -28,6 +28,7 @@ Recommends = False Conflicts = False Extras = False Provides_PyMajorVer_Variant = False +Provides_PyMajorVer_Versions = None PyMajorVer_Deps = False legacy_Provides = False legacy = False @@ -40,7 +41,9 @@ for o, a in opts: print('-r, --recommends\tPrint Recommends') print('-C, --conflicts\tPrint Conflicts') print('-E, --extras\tPrint Extras ') - print('-M, --majorver-provides\tPrint extra Provides with Python major version only') + print('-M, --majorver-provides\tPrint extra Provides with Python major version only for all Python versions') + print(' --majorver-provides-versions VERSIONS\n' + ' \tPrint extra Provides with Python major version only for listed Python VERSIONS (comma separated, no spaces, e.g. 2.7,3.6)') print('-m, --majorver-only\tPrint Provides/Requires with Python major version only') print('-L, --legacy-provides\tPrint extra legacy pythonegg Provides') print('-l, --legacy\tPrint legacy pythonegg Provides/Requires instead') @@ -57,6 +60,8 @@ for o, a in opts: Extras = True elif o in ('-M', '--majorver-provides'): Provides_PyMajorVer_Variant = True + elif o in ('--majorver-provides-versions'): + Provides_PyMajorVer_Versions = a.split(",") elif o in ('-m', '--majorver-only'): PyMajorVer_Deps = True elif o in ('-L', '--legacy-provides'): @@ -64,6 +69,10 @@ for o, a in opts: elif o in ('-l', '--legacy'): legacy = True +if Provides_PyMajorVer_Variant and Provides_PyMajorVer_Versions: + print("Error, options --majorver-provides and --majorver-provides-versions are mutually incompatible.") + exit(2) + if Requires: py_abi = True else: @@ -127,7 +136,7 @@ for f in files: import platform platform.python_version = lambda: dist.py_version - if Provides_PyMajorVer_Variant or PyMajorVer_Deps or legacy_Provides or legacy: + if Provides_PyMajorVer_Variant or PyMajorVer_Deps or legacy_Provides or legacy or Provides_PyMajorVer_Versions: # Get the Python major version pyver_major = dist.py_version.split('.')[0] if Provides: @@ -141,7 +150,8 @@ for f in files: name = 'python{}dist({})'.format(dist.py_version, dist.key) if name not in py_deps: py_deps[name] = [] - if Provides_PyMajorVer_Variant or PyMajorVer_Deps: + if Provides_PyMajorVer_Variant or PyMajorVer_Deps or \ + (Provides_PyMajorVer_Versions and dist.py_version in Provides_PyMajorVer_Versions): pymajor_name = 'python{}dist({})'.format(pyver_major, dist.key) if pymajor_name not in py_deps: py_deps[pymajor_name] = [] @@ -154,7 +164,8 @@ for f in files: if spec not in py_deps[name]: if not legacy: py_deps[name].append(spec) - if Provides_PyMajorVer_Variant: + if Provides_PyMajorVer_Variant or \ + (Provides_PyMajorVer_Versions and dist.py_version in Provides_PyMajorVer_Versions): py_deps[pymajor_name].append(spec) if legacy or legacy_Provides: py_deps[legacy_name].append(spec) diff --git a/SPECS/python-rpm-generators.spec b/SPECS/python-rpm-generators.spec index f65fc0c..587a3a6 100644 --- a/SPECS/python-rpm-generators.spec +++ b/SPECS/python-rpm-generators.spec @@ -5,7 +5,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 5 -Release: 4%{?dist} +Release: 6%{?dist} # Originally all those files were part of RPM, so license is kept here License: GPLv2+ @@ -38,6 +38,10 @@ Conflicts: rpm-build < 4.13.0.1-2 %autosetup -c -T cp -a %{sources} . +# Set which Python versions should have the major-version provides +# (pythonXdist...) generated +sed -i 's/@MAJORVER-PROVIDES-VERSIONS@/2.7,3.6/' python.attr + %install install -Dpm0644 -t %{buildroot}%{_fileattrsdir} python.attr install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondeps.sh pythondistdeps.py @@ -49,6 +53,15 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondeps.sh pythondistdeps.py %{_rpmconfigdir}/pythondistdeps.py %changelog +* Thu Dec 12 2019 Tomas Orsava - 5-6 +- Enabled gating +- Related: rhbz#1776941 + +* Wed Nov 27 2019 Tomas Orsava - 5-5 +- Create major-version provides only on major Python versions (2.7, 3.6) +- Fix an extra parenthesis in python.attr +- Resolves: rhbz#1776941 + * Fri Nov 16 2018 Lumír Balhar - 5-4 - Require platform-python-setuptools instead of python3-setuptools - Resolves: rhbz#1650544