From 663355215ad52fe61ddb5b322446d0d05f14e149 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 17 Jan 2019 22:11:12 +0100 Subject: [PATCH] Make python2 optional --- libtdb.spec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libtdb.spec b/libtdb.spec index 56e5978..e92214b 100644 --- a/libtdb.spec +++ b/libtdb.spec @@ -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