From db8d6d85eec3366623b36a280fb301aefddae931 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Mar 16 2018 12:46:57 +0000 Subject: Conditionalize the Python 2 subpackage --- diff --git a/libnl3.spec b/libnl3.spec index 8d61e8b..472c368 100644 --- a/libnl3.spec +++ b/libnl3.spec @@ -1,6 +1,6 @@ Name: libnl3 Version: 3.4.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Convenience library for kernel netlink sockets Group: Development/Libraries License: LGPLv2 @@ -15,11 +15,15 @@ Source1: http://www.infradead.org/~tgr/libnl/files/libnl-doc-%{fullversion}.tar. #Patch1: some.patch BuildRequires: flex bison -BuildRequires: python2 BuildRequires: libtool autoconf automake BuildRequires: swig -BuildRequires: python2-devel -BuildRequires: python3-devel + +%if 0%{?rhel} > 7 +# Disable python2 build by default +%bcond_with python2 +%else +%bcond_without python2 +%endif %description This package contains a convenience library to simplify @@ -53,17 +57,22 @@ Requires: %{name} = %{version}-%{release} %description doc This package contains libnl3 API documentation +%if %{with python2} %package -n python2-libnl3 %{?python_provide:%python_provide python2-libnl3} Summary: libnl3 binding for Python 2 +BuildRequires: python2-devel Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description -n python2-libnl3 Python 2 bindings for libnl3 +%endif # with python2 %package -n python3-libnl3 Summary: libnl3 binding for Python 3 +%{?python_provide:%python_provide python3-libnl3} +BuildRequires: python3-devel Group: Development/Libraries Requires: %{name} = %{version}-%{release} @@ -84,10 +93,13 @@ make %{?_smp_mflags} pushd ./python/ # build twice, otherwise capi.py is not copied to the build directory. -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build -CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build -CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build +CFLAGS="$RPM_OPT_FLAGS" %py3_build +CFLAGS="$RPM_OPT_FLAGS" %py3_build + +%if %{with python2} +CFLAGS="$RPM_OPT_FLAGS" %py2_build +CFLAGS="$RPM_OPT_FLAGS" %py2_build +%endif # with python2 popd %install @@ -96,8 +108,10 @@ make install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -name \*.la -delete pushd ./python/ -%{__python3} setup.py install --skip-build --root "$RPM_BUILD_ROOT" -%{__python2} setup.py install --skip-build --root "$RPM_BUILD_ROOT" +%py3_install +%if %{with python2} +%py2_install +%endif # with python2 popd %check @@ -105,7 +119,9 @@ make check pushd ./python/ %{__python3} setup.py check +%if %{with python2} %{__python2} setup.py check +%endif # with python2 popd %post -p /sbin/ldconfig @@ -143,10 +159,12 @@ popd %doc libnl-doc-%{fullversion}/images/icons/callouts/* %doc libnl-doc-%{fullversion}/api/* +%if %{with python2} %files -n python2-libnl3 %defattr(-,root,root,-) %{python2_sitearch}/netlink %{python2_sitearch}/netlink-*.egg-info +%endif # with python2 %files -n python3-libnl3 %defattr(-,root,root,-) @@ -154,6 +172,9 @@ popd %{python3_sitearch}/netlink-*.egg-info %changelog +* Fri Mar 16 2018 Charalampos Stratakis - 3.4.0-4 +- Conditionalize the Python 2 subpackage + * Wed Feb 07 2018 Fedora Release Engineering - 3.4.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild