This feature is useful when creating packages for Centos Stream and RHEL
which contain multiple Python stacks and make it possible to build packages for
them.
Packages on PyPI publish wheels which contain an abi tag informing
whether a package contains extensions compiled for a specific
architecture or not.
pyp2conf reads this information and saves it in the config file.
conf2spec automatically adds `gcc` to the generated specfile in case
package is archful.
They were partially defunct, made no actual sense and need to be
forgotten without mercy.
Generating extras for %pyproject_buildrequires (-x foo) will be improved.
For tox dependencies (-t), the users can manually add it to the resulting
spec file.
Create extra subpackages for all of the detected upstream extras.
Due to PyPI API limitations, if an extra is defined as empty
(i.e. without any requirements), it won't be detected.
It is an inherent package property rather than an external factor.
It is the key differentiator for obtaining the package metadata (they
must match the given version release).
Instead of raising multiple sys.exit's throughout the code,
each function either returns a proper value or raises a meaningful
custom error.
The custom errors are caught in each script's main(),
the error message is printed for user and the script exits.
Alongside with the license-related code the tests were significantly
refactored to run offline. The changes are intertwined and so shipped in
a single commit.
The licensing changes:
- updated Trove-Fedora mappings (removed Callaway expressions, added
SPDX)
- delegated the compliance check of Fedora licenses to a source
maintained by the Fedora Legal team
- the logic of license processing was moved to a dedicated module:
license_processor
The testing changes:
- moved betamax configuration to conftest.py to achieve a reliable global setting
- mocked fedora licensing data and PyPI package data to stop making
unnecessary requests - most of the betamax cassettes were deleted
- several tests rewritten, many added
- regenerated remaining betamax cassettes
This is a best-effort solution which can't (nor aims to) cover all edge-cases.
Unless Python adopts SPDX standard, this will always be an approximation.
pyp2conf and pyp2spec share a lot of the same arguments, but they are
currently duplicated. This creates a wrapper function to share
arguments between them, making the code DRYer.
- Replace underscores and dots with dashes in projects' names
Projects like sphinx_design result in python-sphinx-design.spec
and python3-sphinx-design built RPM name.
- Convert uppercase characters to lowercase
Projects like Pello result in python-pello.spec and python3-pello
built RPM name.
This conforms better with package naming guidelines:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_naming
At least when packaging for Fedora, the fact that the specfile is
generated by pyp2spec is irrelevant as far as the changelog is
concerned. Generally, the initial changelog
entry is "Initial package" or something similar.
Signed-off-by: Maxwell G <gotmax@e.email>