Build python3 bindings just for fedora

It simplify backporting to epel/rhel
This commit is contained in:
Lukas Slebodnik 2017-02-14 21:57:30 +01:00
parent c1cb1a91bf
commit 44ef720000

View File

@ -1,3 +1,9 @@
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif
Name: libtdb
Version: 1.3.12
Release: 4%{?dist}
@ -10,7 +16,9 @@ Source: http://samba.org/ftp/tdb/tdb-%{version}.tar.gz
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
Provides: bundled(libreplace)
@ -44,6 +52,7 @@ Requires: libtdb = %{version}-%{release}
%description -n python-tdb
Python bindings for libtdb
%if 0%{?with_python3}
%package -n python3-tdb
Group: Development/Libraries
Summary: Python3 bindings for the Tdb library
@ -51,15 +60,23 @@ Requires: libtdb = %{version}-%{release}
%description -n python3-tdb
Python3 bindings for libtdb
%endif
%prep
%setup -q -n tdb-%{version}
%build
%if 0%{?with_python3}
PY3_CONFIG_FLAGS=--extra-python=%{__python3}
%else
PY3_CONFIG_FLAGS=""
%endif
%configure --disable-rpath \
--bundled-libraries=NONE \
--builtin-libraries=replace \
--extra-python=%{__python3}
$PY3_CONFIG_FLAGS
make %{?_smp_mflags} V=1
%install
@ -99,11 +116,13 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a
%{python_sitearch}/tdb.so
%{python_sitearch}/_tdb_text.py*
%if 0%{?with_python3}
%files -n python3-tdb
%defattr(-,root,root,-)
%{python3_sitearch}/__pycache__/_tdb_text.cpython*.py[co]
%{python3_sitearch}/tdb.cpython*.so
%{python3_sitearch}/_tdb_text.py
%endif
%post -p /sbin/ldconfig
@ -113,9 +132,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a
%postun -n python-tdb -p /sbin/ldconfig
%if 0%{?with_python3}
%post -n python3-tdb -p /sbin/ldconfig
%postun -n python3-tdb -p /sbin/ldconfig
%endif
%changelog
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.12-4