Files
rpms/fedora/SPECS/python-redis.spec

103 lines
2.4 KiB
RPMSpec

%if 0%{?fedora} >= 13 || 0%{?el} >= 8
%global with_python3 1
%endif
%global upstream_name redis
Name: python-%{upstream_name}
Version: 3.2.1
Release: 1%{?dist}
Summary: Python 2 interface to the Redis key-value store
License: MIT
URL: https://github.com/andymccurdy/redis-py
Source0: https://github.com/andymccurdy/redis-py/archive/%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-py
BuildRequires: python2-pytest
BuildRequires: redis
BuildRequires: python2-mock
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1591808
BuildRequires: jemalloc
%global _description\
This is a Python 2 interface to the Redis key-value store.
%description %_description
%package -n python2-redis
Summary: %summary
%{?python_provide:%python_provide python2-redis}
%description -n python2-redis %_description
%if 0%{?with_python3}
%package -n python3-redis
Summary: Python 3 interface to the Redis key-value store
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-py
BuildRequires: python3-pytest
BuildRequires: python3-mock
%description -n python3-redis
This is a Python 3 interface to the Redis key-value store.
%endif
%prep
%setup -qn redis-py-%{version}
rm -frv %{upstream_name}.egg-info
# This test passes locally but fails in koji...
rm tests/test_commands.py*
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%{__python2} setup.py build
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%check
redis-server &
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif
%{__python2} setup.py test
kill %1
%files -n python2-redis
%doc CHANGES LICENSE README.rst
%{python2_sitelib}/%{upstream_name}
%{python2_sitelib}/%{upstream_name}-%{version}-py%{python2_version}.egg-info
%if 0%{?with_python3}
%files -n python3-redis
%doc CHANGES LICENSE README.rst
%{python3_sitelib}/%{upstream_name}
%{python3_sitelib}/%{upstream_name}-%{version}-py%{python3_version}.egg-info
%endif
%changelog
* Sun May 12 2019 Javier Peña <daniel.steiner@dsteiner.ch>
- First build.