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
Improve handling of > operator, preventing post-release from satisfying most rpm requirements.
Improve handling of < operator, preventing pre-release from satisfying rpm requirement.
Improve handling of != operator with prefix matching, preventing pre-release from satisfying rpm requirements.
Upstream change to importlib.metadata: https://github.com/rpm-software-management/rpm/pull/1317
Due to extras packages being hadled slightly differently by importlib,
one test case for this was added. And due to changes in handling
requires.txt files, comments were removed from the pyreq2rpm.tests
testing package.
Also because of the switch, we removed the dependency on setuptools and
added a dependency on packaging.
Note: Some packages with egg-info files might provide a different name
due to this change if there is a conflict between the filename and the
name in the metadata. Previously, the filename was sometimes used to
parse the name, now it is always the content of that file, which is what
packaging does, and thus also pip and other Python tooling. Currently,
this is known to affect only 1 package in Fedora (ntpsec).
The resulting script is different from upstream because of not yet upstreamed changes in Fedora:
- scripts/pythondistdeps: Rework error messages
- scripts/pythondistdeps: Add parameter --package-name
- scripts/pythondistdeps: Implement provides/requires for extras packages
- pythondistdeps.py: When parsing extras name, take the rightmost +
These changes are proposed in this upstream PR: https://github.com/rpm-software-management/rpm/pull/1546
See https://src.fedoraproject.org/rpms/python-setuptools/pull-request/40
Strictly speaking, this is not an RPM generator, but:
- it generates provides
- it is tighly coupled with pythondistdeps.py
Usage:
1. Run `$ /usr/lib/rpm/pythonbundles.py .../vendored.txt`
2. Copy the output into the spec as a macro definition:
%global bundled %{expand:
Provides: bundled(python3dist(appdirs)) = 1.4.3
Provides: bundled(python3dist(packaging)) = 16.8
Provides: bundled(python3dist(pyparsing)) = 2.2.1
Provides: bundled(python3dist(six)) = 1.15
}
3. Use the macro to expand the provides
4. Verify the macro contents in %check:
%check
...
%{_rpmconfigdir}/pythonbundles.py src/_vendor/vendored.txt --compare-with '%{bundled}'
--normalized-names-format FORMAT
FORMAT of normalized names can be `pep503` [default] or `legacy-dots` (dots allowed)
--normalized-names-provide-both
Provede both `pep503` and `legacy-dots` format of normalized names (useful for a transition period)