Package the Python3 bindings

This commit is contained in:
Petr Viktorin 2016-01-13 17:06:51 +01:00 committed by Jakub Hrozek
parent adb83a2c02
commit 5f75edd45c

View File

@ -1,6 +1,11 @@
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif
%define talloc_version 2.0.8
@ -9,7 +14,7 @@
Name: libldb
Version: 1.1.26
Release: 1%{?dist}
Release: 2%{?dist}
Group: Development/Libraries
Summary: A schema-less, ldap like, API and database
Requires: libtalloc%{?_isa} >= %{talloc_version}
@ -41,6 +46,13 @@ BuildRequires: openldap-devel
Provides: bundled(libreplace)
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-tdb
BuildRequires: python3-talloc-devel
BuildRequires: python3-tevent
%endif
# Patches
%description
@ -67,33 +79,86 @@ Requires: pkgconfig
%description devel
Header files needed to develop programs that link against the LDB library.
%package -n pyldb
%package -n python2-ldb
Group: Development/Libraries
Summary: Python bindings for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release}
Requires: python-tdb%{?_isa} >= %{tdb_version}
%description -n pyldb
Provides: pyldb%{?_isa} = %{version}-%{release}
Obsoletes: pyldb%{?_isa} < %{version}-%{release}
%{?python_provide:%python_provide python2-ldb}
%description -n python2-ldb
Python bindings for the LDB library
%package -n pyldb-devel
%package -n python2-ldb-devel
Group: Development/Libraries
Summary: Development files for the Python bindings for the LDB library
Requires: pyldb%{?_isa} = %{version}-%{release}
Requires: python2-ldb%{?_isa} = %{version}-%{release}
Requires: python-ldb-devel-common%{?_isa} = %{version}-%{release}
%description -n pyldb-devel
Provides: pyldb-devel%{?_isa} = %{version}-%{release}
Obsoletes: pyldb-devel%{?_isa} < %{version}-%{release}
%{?python_provide:%python_provide python2-ldb-devel}
%description -n python2-ldb-devel
Development files for the Python bindings for the LDB library
%package -n python-ldb-devel-common
Group: Development/Libraries
Summary: Common development files for the Python bindings for the LDB library
Provides: pyldb-devel%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-ldb-devel}
%description -n python-ldb-devel-common
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
Group: Development/Libraries
Summary: Python bindings for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release}
Requires: python3-tdb%{?_isa} >= %{tdb_version}
%{?python_provide:%python_provide python3-ldb}
%description -n python3-ldb
Python bindings for the LDB library
%package -n python3-ldb-devel
Group: Development/Libraries
Summary: Development files for the Python bindings for the LDB library
Requires: python3-ldb%{?_isa} = %{version}-%{release}
Requires: python-ldb-devel-common%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-ldb-devel}
%description -n python3-ldb-devel
Development files for the Python bindings for the LDB library
%endif
%prep
%setup -q -n ldb-%{version}
%build
%if 0%{?with_python3}
PY3_CONFIG_FLAGS=--extra-python=%{__python3}
%else
PY3_CONFIG_FLAGS=""
%endif
%configure --disable-rpath \
--disable-rpath-install \
--bundled-libraries=NONE \
--builtin-libraries=replace \
--with-modulesdir=%{_libdir}/ldb/modules \
$PY3_CONFIG_FLAGS \
--with-privatelibdir=%{_libdir}/ldb
# Don't build with multiple processors
@ -161,23 +226,46 @@ rm -rf %{buildroot}
%{_mandir}/man3/ldb*.gz
%{_mandir}/man3/ldif*.gz
%files -n pyldb
%files -n python2-ldb
%defattr(-,root,root,-)
%{python_sitearch}/ldb.so
%{python2_sitearch}/ldb.so
%{_libdir}/libpyldb-util.so.1*
%{python_sitearch}/_ldb_text.py*
%{python2_sitearch}/_ldb_text.py*
%files -n pyldb-devel
%files -n python2-ldb-devel
%defattr(-,root,root,-)
%{_includedir}/pyldb.h
%{_libdir}/libpyldb-util.so
%{_libdir}/pkgconfig/pyldb-util.pc
%files -n python-ldb-devel-common
%{_includedir}/pyldb.h
%{_mandir}/man*/Py*.gz
%post -n pyldb -p /sbin/ldconfig
%postun -n pyldb -p /sbin/ldconfig
%post -n python2-ldb -p /sbin/ldconfig
%postun -n python2-ldb -p /sbin/ldconfig
%if 0%{?with_python3}
%files -n python3-ldb
%defattr(-,root,root,-)
%{python3_sitearch}/ldb.cpython-*.so
%{_libdir}/libpyldb-util.cpython-*.so.1*
%{python3_sitearch}/_ldb_text.py
%{python3_sitearch}/__pycache__/_ldb_text.cpython-*.py*
%files -n python3-ldb-devel
%defattr(-,root,root,-)
%{_libdir}/libpyldb-util.cpython-*.so
%post -n python3-ldb -p /sbin/ldconfig
%postun -n python3-ldb -p /sbin/ldconfig
%endif
%changelog
* Tue Jul 05 2016 Petr Viktorin <pviktori@redhat.com> - 1.1.26-2
- Package the Python3 bindings
* Mon Feb 22 2016 Jakub Hrozek <jhrozek@redhat.com> - 1.1.26-1
- New upstream release 1.1.26