Build Python3 package

This commit is contained in:
Jakub Hrozek 2016-04-21 09:58:41 +02:00
parent 252384ad23
commit 0c86b38be0

View File

@ -1,6 +1,14 @@
%{!?python2_sitearch: %global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif
Name: libtevent
Version: 0.9.28
Release: 1%{?dist}
Release: 2%{?dist}
Group: System Environment/Daemons
Summary: The tevent library
License: LGPLv3+
@ -17,6 +25,11 @@ BuildRequires: libxslt
Provides: bundled(libreplace)
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-talloc-devel >= 2.0.7
%endif
%description
Tevent is an event system based on the talloc memory management library.
Tevent has support for many event types, including timers, signals, and
@ -35,14 +48,31 @@ Requires: pkgconfig
Header files needed to develop programs that link against the Tevent library.
%package -n python-tevent
%package -n python2-tevent
Group: Development/Libraries
Summary: Python bindings for the Tevent library
Requires: libtevent%{?_isa} = %{version}-%{release}
%description -n python-tevent
Obsoletes: python-tevent%{?_isa} < %{version}-%{release}
%{?python_provide:%python_provide python2-tevent}
%description -n python2-tevent
Python bindings for libtevent
%if 0%{?fedora}
%package -n python3-tevent
Group: Development/Libraries
Summary: Python 3 bindings for the Tevent library
Requires: libtevent%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-tevent}
%description -n python3-tevent
Python 3 bindings for libtevent
%endif
%prep
# Update timestamps on the files touched by a patch, to avoid non-equal
# .pyc/.pyo files across the multilib peers within a build, where "Level"
@ -62,9 +92,17 @@ UpdateTimestamps() {
%setup -q -n tevent-%{version}
%build
%if 0%{?with_python3}
export PY3_CONFIG_FLAGS=--extra-python=%{__python3}
%else
export PY3_CONFIG_FLAGS=
%endif
%configure --disable-rpath \
--bundled-libraries=NONE \
--builtin-libraries=replace
--builtin-libraries=replace \
$PY3_CONFIG_FLAGS
make %{?_smp_mflags} V=1
@ -100,16 +138,30 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/tevent.pc
%{_mandir}/man3/tevent*.gz
%files -n python-tevent
%files -n python2-tevent
%defattr(-,root,root,-)
%{python_sitearch}/tevent.py*
%{python_sitearch}/_tevent.so
%{python2_sitearch}/tevent.py*
%{python2_sitearch}/_tevent.so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%if 0%{?with_python3}
%files -n python3-tevent
%defattr(-,root,root,-)
%{python3_sitearch}/tevent.py
%{python3_sitearch}/__pycache__/tevent.*
%{python3_sitearch}/_tevent.cpython*.so
%endif
%changelog
* Thu Apr 21 2016 Petr Viktorin <pviktori@redhat.com> - 0.9.28-2
- Build Python 3 package
- Resolves: rhbz#1298250 - libtevent: Provide a Python 3 subpackage
* Mon Feb 22 2016 Jakub Hrozek <jhrozek@redhat.com> - 0.9.28-1
- New upstream release 0.9.28