Allow to combine %pycached with other macros (e.g. %exclude or %ghost)

Previous implementation allowed for only one argument to be passed to
the %pycached macro, which made it impossible to combine it with other macros.

Current implementation allows to pass other macros as arguments to
%pycached.

Example:

    %pycached %exclude /path/to/foo.py

For macro expansion limitations, the opposite order is not possible.
That is to be documented in the guidelines:
https://pagure.io/packaging-committee/pull-request/986

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1838992

Co-authored-by: Marcel Plch <mplch@redhat.com>
epel9
Miro Hrončok 4 years ago
parent 054c9b6b80
commit 07f430f860

@ -62,6 +62,7 @@ install -Dpm 644 %{SOURCE3} \
%changelog
* Sun Jun 07 2020 Miro Hrončok <mhroncok@redhat.com> - 8-12
- Backport %%py_shebang_fix, %%pytest, %%py_provides
- Allow to combine %%pycached with other macros (e.g. %%exclude or %%ghost) (#1838992)
* Thu Apr 30 2020 Troy Dawson <tdawson@redhat.com> - 8-11
- Install python36-rpm-macros or python38-rpm-macros correctly

@ -38,7 +38,7 @@
# This only supports Python 3.5+ and will never work with Python 2.
# Hence, it has no Python version in the name.
%pycached() %{lua:
path = rpm.expand("%{?1}")
path = rpm.expand("%{?*}")
if (string.sub(path, "-3") ~= ".py") then
rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
else

Loading…
Cancel
Save