Go to file
Miro Hrončok 0bd051d514 Don't include all requirements with True-evaluating markers in extras subpackages
The idea is that the extra subpackage only has requirements specific to that extra.
The logic however only excluded requirements without markers,
but requirements with *a* marker that was correct leaked to all extras subpackages.

E.g. with the following requirements:

    Requires-Dist: base-dependency
    Requires-Dist: base-dependency-with-matching-marker ; python_version < "3.15"
    Requires-Dist: base-dependency-with-unmatching-marker ; python_version < "3.8"
    Provides-Extra: an-extra
    Requires-Dist: extra-only-dependency-with-matching-marker ; extra == 'an-extra' and python_version < "3.15"
    Requires-Dist: extra-only-dependency-with-unmatching-marker ; extra == 'an-extra' and python_version < "3.8"

On Python 3.10, the base package generated the following requirements:

    python3.10dist(base-dependency)
    python3.10dist(base-dependency-with-matching-marker)

And for the [an-extra] extra:

    python3.10dist(base-dependency-with-matching-marker)  <--- REDUNDANT, WRONG
    python3.10dist(extra-only-dependency-with-matching-marker)

Now we no longer just check if the marker evaluates to True,
but we also check that the same marker evaluates to False when the extra is not given.

A real package with this issue is build[virtualenv] 0.8.0, which we use for tests. The package has:

    Requires-Dist: tomli (>=1.0.0) ; python_version < "3.11"

And on Python 3.10, it generated the following dependency for python3-build+virtualenv-0.8.0-2.fc37.noarch.rpm:

    python3.10dist(tomli) >= 1

Now it no longer does. This is asserted in tests.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2090186

Upstream PR: https://github.com/rpm-software-management/python-rpm-packaging/pull/16
2022-06-02 12:05:11 +02:00
tests Don't include all requirements with True-evaluating markers in extras subpackages 2022-06-02 12:05:11 +02:00
.gitignore Add __pycache__ into .gitignore 2021-03-11 13:41:54 +01:00
COPYING Fork upstream generators 2018-02-11 00:50:54 +01:00
python-rpm-generators.spec Don't include all requirements with True-evaluating markers in extras subpackages 2022-06-02 12:05:11 +02:00
python.attr Fix python(abi) requires generator, it picked files from almost good directories 2020-06-18 13:32:24 +02:00
pythonbundles.py Support multiple vendor files in pythonbundles.py 2021-06-22 18:28:43 +00:00
pythondist.attr Do not generate setuptools requirement for console_scripts on Python 3.10+ 2021-03-31 11:56:16 +02:00
pythondistdeps.py Don't include all requirements with True-evaluating markers in extras subpackages 2022-06-02 12:05:11 +02:00
pythonname.attr From `python3-foo` packages automatically generate `python3.X-foo` Obsoletes tags on CentOS/RHEL 2022-01-26 17:07:05 +01:00
rpminspect.yaml Add rpminspect file 2022-02-02 15:24:19 +00:00
sources pythondistdeps.py: Compare extras as lowercase 2021-03-11 13:41:25 +01:00
update-test-sources.sh pythondistdeps.py: Compare extras as lowercase 2021-03-11 13:41:25 +01:00