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.
Previously, we have used `grep -v` to assert something is *not* there.
However, that doesn't work. See for example this file:
$ cat TEST
line1
line2
line3
$ grep -v line4 TEST
line1
line2
line3
$ echo $?
0
This gives a false sense of correctness, however it exits will 0 with anything:
$ grep -v line3 TEST
line1
line2
$ echo $?
0
Instead, we use `! grep` now:
$ ! grep line4 TEST
$ echo $?
0
$ ! grep line3 TEST
line3
$ echo $?
1
Additionally, remove a trailing slash from one of the checks to match both cases
(with or without the slash).
This macro save generates file section to %pyproject_files. It should
simplify %files section and allow to build by some automatic machinery
Supposed use case in Fedora:
%install
%pyproject_install
%pyproject_save_files requests _requests
%files -n python3-requests -f %{pyproject_files}
%doc README.rst
%license LICENSE
Automatic build of arbitrary packages (e.g. in Copr):
%install
%pyproject_install
%pyproject_save_files * +bindir // save all modules with executables
%files -n python3-requests -f %{pyproject_files}
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>