Hello Pythonistas,
Let me announce the release of pyproject-rpm-macros 1.9.0.
The new version is available in Rawhide+ELN Koji and updates are penfing for older Fedora releases. A sync to c9s is in progress but will require a review, so it might take longer.
The new version has the following changes compared to 1.8.0:
Allow passing config_settings to the build backend ==================================================
Contributed by Maxwell G (@gotmax23), thank you!
From the README:
------------------------------------------------------------------------------- The %pyproject_buildrequires and %pyproject_wheel macros accept a -C flag to pass configuration settings [1] to the build backend. Options take the form of -C KEY, -C KEY=VALUE, or -C--option-with-dashes. Pass -C multiple times to specify multiple options. This option is equivalent to pip's --config-settings flag. These are passed on to PEP 517 hooks' config_settings argument as a Python dictionary.
The %pyproject_buildrequires macro passes these options to the get_requires_for_build_wheel and prepare_metadata_for_build_wheel hooks. Passing -C to %pyproject_buildrequires is incompatible with -N which does not call these hooks at all.
The %pyproject_wheel macro passes these options to the build_wheel hook.
Consult the project's upstream documentation and/or the corresponding build backend's documentation for more information. Note that some projects don't use config settings at all and other projects may only accept config settings for one of the two steps.
Note that the current implementation of the macros uses pip to build wheels. On some systems (notably on RHEL 9 with Python 3.9), pip is too old to understand --config-settings. Using the -C option for %pyproject_wheel (or %pyproject_buildrequires -w) is not supported there and will result to an error like:
Usage: /usr/bin/python3 -m pip wheel [options] <requirement specifier> ... ... no such option: --config-settings
[1] https://peps.python.org/pep-0517/#config-settings -------------------------------------------------------------------------------
Previously, packagers needed to patch for this: https://src.fedoraproject.org/rpms/python-scikit-misc/c/3dda47b4b7
On Python older than 3.11, use tomli instead of deprecated toml ===============================================================
All currently supported Fedora releases have Python 3.11, so this has not a big effect except for EL 9. However, all packages had generated this BuildRequires:
(python3dist(toml) if python3-devel < 3.11)
This will now be:
(python3dist(tomli) if python3-devel < 3.11)
Such build requirements in Fedora manifests themselves in the results of dnf repoquery --wahtrequires python3-toml(i).
Fix literal % handling in %{pyproject_files} on RPM 4.19 ========================================================
If your package has files with literal % signs in the filenames, it was briefly broken on Fedora Rawhide, because RPM 4.19 now requires 2 % signs to escape them in the filelist (it was 8 in RPM 4.16 and 4.17). This has now been fixed.
Unfortunately, to support both RPM 4.19 and older ones, there is a conditional in %pyproject_save_files which checks the Fedora version. If you run old RPM on Fedora 39 or new RPM on older Fedoras and ahve literal % signs in filenames, it will break. I have requested an %rpmversion macro from RPM and it was added upstream. Once propagated to Fedora, the conditional will be replaced.
Happy packaging!