From 44ef7200000fd984a5e5777ba2a2c6d517f5cc72 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Feb 28 2017 09:22:45 +0000 Subject: Build python3 bindings just for fedora It simplify backporting to epel/rhel --- diff --git a/libtdb.spec b/libtdb.spec index a2ed4c5..3b64945 100644 --- a/libtdb.spec +++ b/libtdb.spec @@ -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 - 1.3.12-4