Make python2 optional

+ reorder few lines
This commit is contained in:
Lukas Slebodnik 2019-01-17 21:31:40 +01:00
parent 441abecf8f
commit e981f5980f

View File

@ -2,8 +2,10 @@
%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
%global talloc_version 2.1.15
@ -18,19 +20,20 @@ Source: http://samba.org/ftp/tevent/tevent-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: libtalloc-devel >= %{talloc_version}
BuildRequires: python2-devel
BuildRequires: python2-talloc-devel >= %{talloc_version}
BuildRequires: doxygen
BuildRequires: docbook-style-xsl
BuildRequires: libxslt
Provides: bundled(libreplace)
%if 0%{?with_python2}
BuildRequires: python2-devel
BuildRequires: python2-talloc-devel >= %{talloc_version}
%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-talloc-devel >= %{talloc_version}
%endif
Provides: bundled(libreplace)
%description
Tevent is an event system based on the talloc memory management library.
Tevent has support for many event types, including timers, signals, and
@ -48,6 +51,7 @@ Requires: pkgconfig
Header files needed to develop programs that link against the Tevent library.
%if 0%{?with_python2}
%package -n python2-tevent
Summary: Python bindings for the Tevent library
Requires: libtevent%{?_isa} = %{version}-%{release}
@ -56,9 +60,9 @@ Requires: libtevent%{?_isa} = %{version}-%{release}
%description -n python2-tevent
Python bindings for libtevent
%endif
%if 0%{?with_python3}
%package -n python3-tevent
Summary: Python 3 bindings for the Tevent library
Requires: libtevent%{?_isa} = %{version}-%{release}
@ -67,7 +71,6 @@ Requires: libtevent%{?_isa} = %{version}-%{release}
%description -n python3-tevent
Python 3 bindings for libtevent
%endif
%prep
@ -132,21 +135,21 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir}
%{_libdir}/pkgconfig/tevent.pc
%{_mandir}/man3/tevent*.gz
%if 0%{?with_python2}
%files -n python2-tevent
%{python2_sitearch}/tevent.py*
%{python2_sitearch}/_tevent.so
%ldconfig_scriptlets
%endif
%if 0%{?with_python3}
%files -n python3-tevent
%{python3_sitearch}/tevent.py
%{python3_sitearch}/__pycache__/tevent.*
%{python3_sitearch}/_tevent.cpython*.so
%endif
%ldconfig_scriptlets
%changelog
* Thu Jan 17 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.38-1
- New upstream release 0.9.38