[libvirt] [python PATCH] rpm: use new python macros for build/install rules

Daniel P. Berrangé posted 1 patch 5 years ago
Failed in applying to current master (apply log)
libvirt-python.spec.in | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
[libvirt] [python PATCH] rpm: use new python macros for build/install rules
Posted by Daniel P. Berrangé 5 years ago
The new %py{2,3}_{build,install} macros ensure that the right compiler
and linker flags are used when building python modules.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 libvirt-python.spec.in | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 5bcf1eb..8dd261f 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -119,19 +119,35 @@ exit 1
 %endif
 
 %if %{with_python2}
+%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8
+%py2_build
+%else
 CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
 %endif
+%endif
 %if %{with_python3}
+%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8
+%py3_build
+%else
 CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
 %endif
+%endif
 
 %install
 %if %{with_python2}
+%if 0%{?fedora} || 0%{?rhel} >= 8
+%py2_install
+%else
 %{__python2} setup.py install --skip-build --root=%{buildroot}
 %endif
+%endif
 %if %{with_python3}
+%if 0%{?fedora} || 0%{?rhel} >= 8
+%py3_install
+%else
 %{__python3} setup.py install --skip-build --root=%{buildroot}
 %endif
+%endif
 
 %check
 %if %{with_python2}
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [python PATCH] rpm: use new python macros for build/install rules
Posted by Andrea Bolognani 5 years ago
On Wed, 2019-04-03 at 18:11 +0100, Daniel P. Berrangé wrote:
[...]
>  %if %{with_python2}
> +%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8
> +%py2_build
> +%else

So based on this it looks like the %py*_build macros were only
introduced in Fedora 29...

>  %if %{with_python2}
> +%if 0%{?fedora} || 0%{?rhel} >= 8
> +%py2_install
> +%else

... but based on this it seems like the %py*_install macros were
already present in Fedora 28?

Looking at my Fedora 28 guest, more specifically in

  /usr/lib/rpm/macros.d/macros.python*

I see the %py*_build macros, so I guess the latter version is the
correct one.

Once you've removed the bogus '>= 29's,

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [python PATCH] rpm: use new python macros for build/install rules
Posted by Daniel P. Berrangé 5 years ago
On Thu, Apr 04, 2019 at 12:18:39PM +0200, Andrea Bolognani wrote:
> On Wed, 2019-04-03 at 18:11 +0100, Daniel P. Berrangé wrote:
> [...]
> >  %if %{with_python2}
> > +%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8
> > +%py2_build
> > +%else
> 
> So based on this it looks like the %py*_build macros were only
> introduced in Fedora 29...
> 
> >  %if %{with_python2}
> > +%if 0%{?fedora} || 0%{?rhel} >= 8
> > +%py2_install
> > +%else
> 
> ... but based on this it seems like the %py*_install macros were
> already present in Fedora 28?

Yeah, it in fact dates back to F27. I just forgot to chop the F29
conditional out fully.

> Looking at my Fedora 28 guest, more specifically in
> 
>   /usr/lib/rpm/macros.d/macros.python*
> 
> I see the %py*_build macros, so I guess the latter version is the
> correct one.
> 
> Once you've removed the bogus '>= 29's,
> 
>   Reviewed-by: Andrea Bolognani <abologna@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list