Conditionalize the Python 2 subpackage

This commit is contained in:
Charalampos Stratakis 2018-03-16 13:46:57 +01:00
parent 6acacc2442
commit db8d6d85ee

View File

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