On 12/11/2013 09:31 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This updates autobuild.sh to test the python3 build process.
The RPM specfile is changed to build a libvirt-python3 RPM
on Fedora > 18
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
autobuild.sh | 6 ++++++
libvirt-python.spec.in | 57 +++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 56 insertions(+), 7 deletions(-)
+++ b/libvirt-python.spec.in
@@ -1,5 +1,10 @@
-Summary: The libvirt virtualization API python binding
+%global with_python3 0
+%if 0%{?fedora} > 18
+%global with_python3 1
+%endif
Is %global the right thing to use? Elsewhere we have just used %define
when setting up a variable that conditionalizes the rest of the spec file.
%build
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
How far back can we assume that %{__python2} exists? Is it going to
bite us on RHEL 6 (where I'm guessing there is just %{__python})?
+%if %{with_python3}
+CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+%endif
%install
-%{__python} setup.py install --skip-build --root=%{buildroot}
+%{__python2} setup.py install --skip-build --root=%{buildroot}
More use of %{__python2}.
Everything else looks okay to me, although I did not actually do any
testing of the rpms.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org