Hi.
On 3/16/21 8:22 PM, Jos de Kloe wrote:
Hi Miro,
in general I think explicit is better than implicit
(and since I am Dutch, this seems obvious to me).
I agree with Jos here. From my recent experience with onbording a new
packager it seems that our macros (old and new ones) are just enough
level of abstraction but the overall specfile still looks like other
specfiles and that's good. You never know when somebody needs to update
a Python specfile and if they have a different background, it's good
that they can understand at least the core structure of the specfile.
But regarding your question, I think a better argument for creating a
macro is to prevent mistakes from packagers. I think that is more
relevant than avoiding a few lines of code in a spec file.
For myself, I am happy as long as I can find or print the definition
of a macro easily. For some this is easy enough, i.e.:
> rpm --eval '%py3_install'
\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}"
LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\
/usr/bin/python3 setup.py install -O1 --skip-build --root
$HOME/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64
rm -rfv
$HOME/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin/__pycache__
and this also illustrates my earlier point, since I am sure I would
forget setting this CFLAGS and LD_FLAGS often (are they really needed
for plain python packages?).
But for other macros this just doesn't work, i.e.:
> rpm --eval '%autosetup'
error: lua script failed: attempt to index a nil value
And actually, it is also not obvious to me where this one is defined
(a grep on the files in /usr/lib/rpm/macros.d/ did not tell me
anything relevant).
Cheers,
Jos.
On 3/16/21 10:32 AM, Miro Hrončok 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?
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to
python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure