diff --git a/libtalloc.spec b/libtalloc.spec index 8ce1fb1..f572391 100644 --- a/libtalloc.spec +++ b/libtalloc.spec @@ -1,7 +1,9 @@ %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 Name: libtalloc @@ -16,7 +18,9 @@ Source: https://www.samba.org/ftp/talloc/talloc-%{version}.tar.gz BuildRequires: gcc BuildRequires: libxslt BuildRequires: docbook-style-xsl +%if 0%{?with_python2} BuildRequires: python2-devel +%endif %if 0%{?with_python3} BuildRequires: python3-devel %endif @@ -37,6 +41,7 @@ Requires: libtalloc = %{version}-%{release} %description devel Header files needed to develop programs that link against the Talloc library. +%if 0%{?with_python2} %package -n python2-talloc Group: Development/Libraries Summary: Python bindings for the Talloc library @@ -60,6 +65,7 @@ Obsoletes: pytalloc-devel < 2.1.3 %description -n python2-talloc-devel Development libraries for python2-talloc +%endif %if 0%{?with_python3} %package -n python3-talloc @@ -132,6 +138,7 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir} %{_mandir}/man3/talloc*.3.gz %{_mandir}/man3/libtalloc*.3.gz +%if 0%{?with_python2} %files -n python2-talloc %{_libdir}/libpytalloc-util.so.* %{python2_sitearch}/talloc.so @@ -140,6 +147,7 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir} %{_includedir}/pytalloc.h %{_libdir}/pkgconfig/pytalloc-util.pc %{_libdir}/libpytalloc-util.so +%endif %if 0%{?with_python3} %files -n python3-talloc @@ -154,7 +162,9 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir} %ldconfig_scriptlets +%if 0%{?with_python2} %ldconfig_scriptlets -n python2-talloc +%endif %if 0%{?with_python3} %ldconfig_scriptlets -n python3-talloc