On Tue, Mar 16, 2021 at 5:32 AM Miro Hrončok <mhroncok(a)redhat.com> wrote:
Hello Pythonistas.
I find myself cop-pasting this boring snippet each time I create a Python
package (using the old macros or the new):
%package -n python3-foo
Summary: %{summary}
%description -n python3-foo %_description
And using one of those in %files:
%files -n python3-foo
%files -n python3-foo -f %{pyproject_files}
I wonder whether it makes sense to macronize this.
For example:
Name: python-foo
...
%global _description %{expand:
This is the description for both SRPM and the python3-foo package.}
%description %_description
%py3_package %_description
...
%py3_files
...
Or maybe even (if possible):
Name: python-foo
...
%py3_package_with_description
This is the description for both SRPM and the python3-foo package.
...
%py3_files
...
Both macros would figure the package name by replacing the python- prefix from
%{name} with python3-.
Pros: No more copy-paste-edit \o/
Cons: The more is hidden from the reader behind automagic macros, the less
obvious is the spec file to somebody who tries to read or modify it :(
What is your opinion?
I would actually like this, and make it easy for us to build for
multiple Pythons (even if we don't do it by default in Fedora). This
is how openSUSE works with their "singlespec" model[1], and I have
come to appreciate it, even though I don't like some of the details of
the openSUSE implementation (such as weird parsing and rewriting of
stanzas for dependencies instead of the use of a generator and the
usage of alternatives, as shown in this example[2]).
[1]:
https://en.opensuse.org/openSUSE:Packaging_Python#What_is_single-spec.3F
[2]:
https://build.opensuse.org/package/view_file/devel:languages:python:flask...
--
真実はいつも一つ!/ Always, there's only one truth!