Make python2 optional

This commit is contained in:
Lukas Slebodnik 2019-01-17 23:34:19 +01:00
parent c627f945ea
commit 9427f0d5bc

View File

@ -4,8 +4,10 @@
%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
%global talloc_version 2.1.15
@ -31,22 +33,23 @@ BuildRequires: lmdb-devel >= 0.9.16
BuildRequires: popt-devel
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%if 0%{?with_python2}
BuildRequires: python2-devel
BuildRequires: python2-tdb
BuildRequires: python2-talloc-devel
BuildRequires: python2-tevent
BuildRequires: doxygen
BuildRequires: openldap-devel
BuildRequires: libcmocka-devel
Provides: bundled(libreplace)
%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-tdb
BuildRequires: python3-talloc-devel
BuildRequires: python3-tevent
%endif
BuildRequires: doxygen
BuildRequires: openldap-devel
BuildRequires: libcmocka-devel
Provides: bundled(libreplace)
# Patches
Patch0001: 0002-ldb-Run-at-least-some-tests-on-32-bit-machines.patch
@ -73,6 +76,7 @@ Requires: pkgconfig
%description devel
Header files needed to develop programs that link against the LDB library.
%if 0%{?with_python2}
%package -n python2-ldb
Summary: Python bindings for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release}
@ -98,6 +102,7 @@ Obsoletes: pyldb-devel < 1.1.26-2
%description -n python2-ldb-devel
Development files for the Python bindings for the LDB library
%endif
%package -n python-ldb-devel-common
Summary: Common development files for the Python bindings for the LDB library
@ -110,7 +115,6 @@ Development files for the Python bindings for the LDB library.
This package includes files that aren't specific to a Python version.
%if 0%{?with_python3}
%package -n python3-ldb
Summary: Python bindings for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release}
@ -130,7 +134,6 @@ Requires: python-ldb-devel-common%{?_isa} = %{version}-%{release}
%description -n python3-ldb-devel
Development files for the Python bindings for the LDB library
%endif
%prep
@ -221,6 +224,11 @@ rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/_*
%{_mandir}/man3/ldb*.gz
%{_mandir}/man3/ldif*.gz
%files -n python-ldb-devel-common
%{_includedir}/pyldb.h
%{_mandir}/man*/Py*.gz
%if 0%{?with_python2}
%files -n python2-ldb
%{python2_sitearch}/ldb.so
%{_libdir}/libpyldb-util.so.1*
@ -230,14 +238,10 @@ rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/_*
%{_libdir}/libpyldb-util.so
%{_libdir}/pkgconfig/pyldb-util.pc
%files -n python-ldb-devel-common
%{_includedir}/pyldb.h
%{_mandir}/man*/Py*.gz
%ldconfig_scriptlets -n python2-ldb
%endif
%if 0%{?with_python3}
%files -n python3-ldb
%{python3_sitearch}/ldb.cpython-*.so
%{_libdir}/libpyldb-util.cpython-*.so.1*
@ -249,7 +253,6 @@ rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/_*
%{_libdir}/pkgconfig/pyldb-util.cpython-*.pc
%ldconfig_scriptlets -n python3-ldb
%endif
%changelog