summaryrefslogtreecommitdiff
path: root/libvirt-python.spec.in
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2018-01-11 16:20:34 +0000
committerDaniel P. Berrange <berrange@redhat.com>2018-01-12 18:15:27 +0000
commitba234bd83140ec96cb966fb6ec99e071dffac278 (patch)
tree274dba644d9b3178a053fc4a5f1dc01905bd0089 /libvirt-python.spec.in
parent85c371bd26373146b0d560931d78a40f4924818b (diff)
downloadlibvirt-python-ba234bd83140ec96cb966fb6ec99e071dffac278.tar.gz
Allow disabling of python2 RPM build
With Fedora modularity, it is possible to have add-on repos for multiple versions of python3. It is thus desirable to be able to build libvirt-python in these repos, with only the python3 sub-RPMs enabled. Thus also helps if future RHEL/Fedora drop python2 entirely from their default repos. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'libvirt-python.spec.in')
-rw-r--r--libvirt-python.spec.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 4d0262d..5bbebeb 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,4 +1,5 @@
+%define with_python2 1
%define with_python3 0
%if 0%{?fedora}
%define with_python3 1
@@ -13,9 +14,11 @@ Url: http://libvirt.org
License: LGPLv2+
Group: Development/Libraries
BuildRequires: libvirt-devel >= @C_VERSION@
+%if %{with_python2}
BuildRequires: python-devel
BuildRequires: python-nose
BuildRequires: python-lxml
+%endif
%if %{with_python3}
BuildRequires: python3-devel
BuildRequires: python3-nose
@@ -32,6 +35,7 @@ written in the Python programming language to use the interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
+%if %{with_python2}
%package -n python2-libvirt
Summary: The libvirt virtualization API python2 binding
Url: http://libvirt.org
@@ -46,6 +50,7 @@ The python2-libvirt package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
+%endif
%if %{with_python3}
%package -n python3-libvirt
@@ -73,23 +78,30 @@ of recent versions of Linux (and other OSes).
find examples -type f -exec chmod 0644 \{\} \;
%build
+%if %{with_python2}
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%endif
%if %{with_python3}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
%endif
%install
+%if %{with_python2}
%{__python} setup.py install --skip-build --root=%{buildroot}
+%endif
%if %{with_python3}
%{__python3} setup.py install --skip-build --root=%{buildroot}
%endif
%check
+%if %{with_python2}
%{__python} setup.py test
+%endif
%if %{with_python3}
%{__python3} setup.py test
%endif
+%if %{with_python2}
%files -n python2-libvirt
%defattr(-,root,root)
%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
@@ -98,6 +110,7 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
%{_libdir}/python2*/site-packages/libvirt_lxc.py*
%{_libdir}/python2*/site-packages/libvirtmod*
%{_libdir}/python2*/site-packages/*egg-info
+%endif
%if %{with_python3}
%files -n python3-libvirt