Make python2 optional

This commit is contained in:
Lukas Slebodnik 2019-01-17 22:11:12 +01:00
parent a74bbd74ab
commit 663355215a

View File

@ -1,7 +1,9 @@
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%else
%global with_python3 0
%endif
%if 0%{?fedora} || 0%{?rhel} < 8
%global with_python2 1
%endif
Name: libtdb
@ -15,7 +17,9 @@ Source: http://samba.org/ftp/tdb/tdb-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%if 0%{?with_python2}
BuildRequires: python2-devel
%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
@ -42,6 +46,7 @@ Requires: libtdb = %{version}-%{release}
%description -n tdb-tools
Tools to manage Tdb files
%if 0%{?with_python2}
%package -n python2-tdb
Summary: Python bindings for the Tdb library
Requires: libtdb = %{version}-%{release}
@ -49,6 +54,7 @@ Requires: libtdb = %{version}-%{release}
%description -n python2-tdb
Python bindings for libtdb
%endif
%if 0%{?with_python3}
%package -n python3-tdb
@ -109,9 +115,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a
%{_mandir}/man8/tdbtool.8*
%{_mandir}/man8/tdbrestore.8*
%if 0%{?with_python2}
%files -n python2-tdb
%{python2_sitearch}/tdb.so
%{python2_sitearch}/_tdb_text.py*
%endif
%if 0%{?with_python3}
%files -n python3-tdb
@ -124,9 +132,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a
%postun -p /sbin/ldconfig
%if 0%{?with_python2}
%post -n python2-tdb -p /sbin/ldconfig
%postun -n python2-tdb -p /sbin/ldconfig
%endif
%if 0%{?with_python3}
%post -n python3-tdb -p /sbin/ldconfig