%if 0%{?fedora} %global with_python3 1 %endif %global pypi_name kafka-python Name: python-kafka Version: 0.9.4 Release: 1%{?dist} Summary: Pure Python client for Apache Kafka License: ASL 2.0 URL: https://github.com/mumrah/%{pypi_name} Source0: https://pypi.python.org/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 * Tue Nov 17 2015 Pradeep Kilambi 0.9.4 - Initial package based on python-kafka.