Hello,
the new versions of pyproject-rpm-macros (0-49) and python-rpm-macros
(3.10-12) landed in Rawhide. Updates are available for older Fedoras:
F35:
https://bodhi.fedoraproject.org/updates/FEDORA-2021-fd8d8c5f66
F34:
https://bodhi.fedoraproject.org/updates/FEDORA-2021-22b68be2d5
F33:
https://bodhi.fedoraproject.org/updates/FEDORA-2021-d085ce09ef
They bring some enhancements I'd like to briefly describe here:
pyproject-rpm-macros
A new macro, %pyproject_check_import, has been introduced.
You'll benefit from it if you use %pyproject_save_files in your specfile.
It can play a role of a smoke test in cases when the upstream tests
suite doesn't exist or can't be used.
When %pyproject_save_files is invoked, it creates a list of all valid
and public (i.e. not starting with `_`) importable module names found in
the package.
This list is then used by %pyproject_check_import to perform an import
check for each listed module.
When a module fails to import, the build fails.
Call %pyproject_check_import in %check to perform a test on all found
modules:
%check
%pyproject_check_import
%pyproject_check_import can be modified with -t flag, which performs a
check only on top-level module names (i.e. not containing dot):
%check
%pyproject_check_import -t
%pyproject_check_import can be modified with -e flag, which excludes the
module names matching given glob(s) from the import check:
%check
%pyproject_check_import -e '*.test*' -e '*.config'
A more detailed explanation of the macro can be found in the project's
README. [0].
The %pyproject_check_import macro calls %py3_check_import underneath,
which has received a few improvements as well. To use the
%pyproject_check_import macro, make sure to have the most recent
python3-rpm-macros installed (for various reasons, a versioned
dependency is *not* used) -- not only in the buildroot but also on the
host (if installed at all).
python-rpm-macros
The API of %py3_check_import was extended to support the
%pyproject_check_import use case. 3 new flags were added:
-t (top-level)
-e (exclude glob(s))
-f (a path to a file with qualified module names, separated with
newlines)
The -e and -f options can be used repeatedly. We expect this new API to
be used mostly via %pyproject_check_import, but it is not the only option.
When using %py3_check_import, you don't need to invoke
%pyproject_save_files.
Happy packaging,
Karolina Surma
[0]
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/RE...