From 4b0bf940820a72c0b5af501c339a3a651e8dff15 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Sat, 3 Dec 2016 18:19:27 +0100 Subject: [PATCH] Build python3 bindings just for fedora It simplify backporting to epel/rhel --- libtalloc.spec | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libtalloc.spec b/libtalloc.spec index e0dca21..e9d0434 100644 --- a/libtalloc.spec +++ b/libtalloc.spec @@ -1,3 +1,9 @@ +%if 0%{?fedora} +%global with_python3 1 +%else +%global with_python3 0 +%endif + Name: libtalloc Version: 2.1.8 Release: 3%{?dist} @@ -12,7 +18,9 @@ BuildRequires: autoconf BuildRequires: libxslt BuildRequires: docbook-style-xsl BuildRequires: python2-devel +%if 0%{?with_python3} BuildRequires: python3-devel +%endif BuildRequires: doxygen Provides: bundled(libreplace) @@ -52,6 +60,7 @@ Obsoletes: pytalloc-devel < 2.1.3 %description -n python-talloc-devel Development libraries for python-talloc +%if 0%{?with_python3} %package -n python3-talloc Group: Development/Libraries Summary: Python bindings for the Talloc library @@ -67,17 +76,25 @@ Requires: python3-talloc = %{version}-%{release} %description -n python3-talloc-devel Development libraries for python3-talloc +%endif %prep %setup -q -n talloc-%{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 \ --disable-silent-rules \ - --extra-python=%{__python3} + $PY3_CONFIG_FLAGS make %{?_smp_mflags} V=1 doxygen doxy.config @@ -123,6 +140,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/pytalloc-util.pc %{_libdir}/libpytalloc-util.so +%if 0%{?with_python3} %files -n python3-talloc %defattr(-,root,root,-) %{_libdir}/libpytalloc-util.cpython*.so.* @@ -133,6 +151,7 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/pytalloc.h %{_libdir}/pkgconfig/pytalloc-util.pc %{_libdir}/libpytalloc-util.cpython*.so +%endif %post -p /sbin/ldconfig @@ -141,8 +160,10 @@ rm -rf $RPM_BUILD_ROOT %post -n python-talloc -p /sbin/ldconfig %postun -n python-talloc -p /sbin/ldconfig +%if 0%{?with_python3} %post -n python3-talloc -p /sbin/ldconfig %postun -n python3-talloc -p /sbin/ldconfig +%endif %changelog * Fri Feb 10 2017 Fedora Release Engineering - 2.1.8-3