Commit Graph

7 Commits

Author SHA1 Message Date
Miro Hrončok
ea56d1c870 Don't exit from pyproject-srpm-macros implementation of %pyproject_buildrequires
- Fixes: rhbz#2391290

Consider code like this:

    %generate_buildrequires
    mv setup.py{,.ignore}
    %pyproject_buildrequires
    mv setup.py{.ignore,}

When %pyproject_buildrequires exits, the second mv is never executed.
The next round of %generate_buildrequires will then fail.

In fact, there is probably not a good reason to call exit from %pyproject_buildrequires.

From https://src.fedoraproject.org/rpms/libcpuid/pull-request/7
2025-09-01 13:18:45 +02:00
Miro Hrončok
c1de18f683 Accept arbitrary options from %pyproject_buildrequires in pyproject-srpm-macros
This way, when we add new options to the actual macro in pyproject-rpm-macros,
spec files that use them are parsable with the old pyproject-srpm-macros package.

Last time, when we added the -g option in 1.16.0,
it took at least a week for Fedora CI to be able to parse a spec file with it,
as pyproject-srpm-macros 1.16.0+ needed to actually be installed on the CI systems.

Next time this happens, the new option will be parsable with older versions of pyproject-rpm-macros

Note that the (-) syntax is not supported yet on RPM 4.16 in RHEL 9.
I'd use an expression to keep the literal set of flags for older RPM versions:

    %pyproject_buildrequires(%[v"0%{?rpmversion}" >= v"4.19" ? "-" : "rRxtNwpe:g:C:"])

But macro options are not processed as macros:
https://github.com/rpm-software-management/rpm/issues/3440

As a result, this is not compatible with RHEL 9 and cannot be backported to it.
Unless the (-) syntax is backported:
https://issues.redhat.com/browse/RHEL-67161
https://gitlab.com/redhat/centos-stream/rpms/rpm/-/merge_requests/60
2024-12-03 12:58:44 +01:00
Miro Hrončok
307d2bef63 %pyproject_buildrequires: Add support for dependency groups (PEP 735), via the -g flag 2024-11-05 11:31:33 +01:00
Karolina Surma
9f43e2a760 Add a possibility to read runtime dependencies from pyproject.toml
This adds a new flag, -p, to %pyproject_buildrequires.
When set, the runtime dependencies are read from the pyproject.toml's
[project] table.

See: https://bugzilla.redhat.com/2261939

pyproject_buildrequires.py already had a short `-p` option for
--python3_pkgversion (hidden from the macro users).
This change removes the one-letter option and leaves the long-one.
`-p` is now reused for reading dependencies from pyproject.toml
and made visible to the macro users.
2024-09-23 11:48:20 +02:00
Miro Hrončok
e7b37d02f8 Add a provisional RPM Declarative Buildsystem (RPM 4.20+) 2024-07-25 11:54:55 +02:00
156e2fc8fe
Allow passing config_settings to the build backend
Resolves: https://bugzilla.redhat.com/2192581
2023-05-31 19:26:32 +00:00
Miro Hrončok
a4d05ba2c2 Add pyproject-srpm-macros with a minimal %pyproject_buildrequires macro
pyproject-srpm-macros is intended to be installed in the default buildroot.

That way, no explicit BuildRequires for pyproject-rpm-macros are required,
as long as %pyproject_buildrequires is used in %generate_buildrequires.

When only pyproject-srpm-macros is installed, the minimal implementation of
%pyproject_buildrequires generates a dependency on pyproject-rpm-macros.
When pyproject-rpm-macros is installed, it overrides the implementation
of %pyproject_buildrequires with the full one.

Note that in Fedora, pyproject-rpm-macros is required by python3-devel,
but not in RHEL.
This allows us to keep pyproject-rpm-macros in the RHEL CRB repository.
2023-01-20 21:57:49 +01:00