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:
They bring some enhancements I'd like to briefly describe here:
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
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
%pyproject_check_import can be modified with -t flag, which performs a
check only on top-level module names (i.e. not containing dot):
%pyproject_check_import can be modified with -e flag, which excludes the
module names matching given glob(s) from the import check:
%pyproject_check_import -e '*.test*' -e '*.config'
A more detailed explanation of the macro can be found in the project's
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).
The API of %py3_check_import was extended to support the
%pyproject_check_import use case. 3 new flags were added:
-e (exclude glob(s))
-f (a path to a file with qualified module names, separated with
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