If "License-File" is present in Metadata file, we can safely add the
`-l` flag to %pyproject_save_files. The flag asserts that at least
one license file is marked as %license in the %files section
when there are none specified manually.
Not all build backends expose the field yet, which was oficially added
to Core Metadata 2.4 with PEP 639.
Yellow - operating on the discovered information
Magenta - requires attention, not bad per se
Red - something bad has happened
Also, done cosmetic changes to the printed sentences, ain't noboody got
time to read novels.
For automated environments, we want to ensure buildability of the
created specfile, hence adding `"*" +auto` to %pyproject_save_files.
In the real Fedora packages, the valid argument to %pyproject_save_files
is a list of module names.
For now there's no automatic way to discover what modules the package
contains, so when a human user invokes pyp2spec, we want to generate a
file with placeholder (...) for them to fill in after the package
inspection.
- Utilize the new macro %_pyproject_check_import_allow_no_modules to allow
passing check in automated environments, even when the package doesn't
contain any Python modules (fixes#31).
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.