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

Daniel P. Berrangé berrange at redhat.com
Wed Apr 3 17:11:22 UTC 2019


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 at 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




More information about the libvir-list mailing list