Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif
%global pypi_name kafka-python

Name:             python-kafka
Version:          1.3.1
Release:          2%{?dist}
Summary:          Pure Python client for Apache Kafka

License:          ASL 2.0
URL:              https://github.com/mumrah/%{pypi_name}
Source0:          https://pypi.io/packages/source/k/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

BuildArch:        noarch
BuildRequires:    python-setuptools
BuildRequires:    python2-devel
BuildRequires:    python-pbr
BuildRequires:    python-sphinx

Requires: python-six

%description
This module provides low-level protocol support for Apache Kafka as well as high-level
consumer and producer classes. Request batching is supported by the protocol as well as
broker-aware request routing. Gzip and Snappy compression is also supported for message
sets.

%if 0%{?with_python3}
%package -n python3-kafka
Summary:          Pure Python client for Apache Kafka
BuildRequires:    python3-setuptools
BuildRequires:    python3-devel
BuildRequires:    python3-sphinx

%description -n python3-kafka
This module provides low-level protocol support for Apache Kafka as well as high-level
consumer and producer classes. Request batching is supported by the protocol as well as
broker-aware request routing. Gzip and Snappy compression is also supported for message
sets.

%endif # with_python3

%prep
%setup -qc -n %{pypi_name}-%{version}
mv %{pypi_name}-%{version} python2
pushd python2
# Common docs
cp -a README.rst ../
popd

%if 0%{?with_python3}
cp -a python2 python3
find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find python2 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%build
pushd python2
%{__python2} setup.py build
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%endif # with_python3


%install
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd


%files
%doc README.rst
%{python2_sitelib}/kafka
%{python2_sitelib}/*.egg-info

%if 0%{?with_python3}
%files -n python3-kafka
%{python3_sitelib}/kafka
%{python3_sitelib}/kafka*.egg-info
%doc README.rst
%endif # with_python3


%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jan 26 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 1.3.1-1
- Upstream 1.3.1

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.9.4-4
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 17 2015 Pradeep Kilambi <pkilambi@redhat.com> 0.9.4
- Initial package based on python-kafka.