%global commit 1f38ac79ef9a224f4d84e465bcf91f71aff670db %global shortcommit %(c=%{commit}; echo ${c:0:7}) %if 0%{?fedora} >= 24 || 0%{?rhel} > 7 %global with_python3 1 %global with_python2 0 %endif %global library tinyrpc %global module tinyrpc Name: python-%{library} Version: 0.5 Release: 4.20170523git1f38ac%{?dist} Provides: python2-tinyrpc = %{version}-%{release} Summary: A modular RPC library License: MIT URL: https://github.com/mbr/%{library} Source0: https://github.com/mbr/%{library}/archive/%{commit}/%{library}-%{version}-%{shortcommit}.tar.gz BuildArch: noarch %if 0%{?with_python2} Requires: python-funcsigs Requires: python-gevent Requires: python-greenlet Requires: python-requests Requires: python-six Requires: python-werkzeug #Requires: python-zmq BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: git BuildRequires: python-funcsigs BuildRequires: python-gevent BuildRequires: python-greenlet BuildRequires: python-mock BuildRequires: python-py BuildRequires: python-pytest BuildRequires: python-requests BuildRequires: python-six BuildRequires: python-sphinx BuildRequires: python-werkzeug #BuildRequires: python-zmq %package -n python-%{library}-tests Provides: python2-%{library}-tests = %{version}-%{release} Summary: Tests for python-tinyrpc library Requires: python-funcsigs Requires: python-gevent Requires: python-greenlet Requires: python-mock Requires: python-py Requires: python-pytest Requires: python-requests Requires: python-six Requires: python-werkzeug #Requires: python-zmq Requires: python-%{library} = %{version}-%{release} %description -n python-%{library}-tests Tests for python-tinyrpc library %package -n python-%{library}-doc Summary: Documentation for tinyrpc library %description -n python-%{library}-doc Documentation for tinyrpc library %endif %if 0%{?with_python3} %package -n python3-%{library} Summary: A modular RPC library %{?python_provide:%python_provide python3-%{library}} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-funcsigs BuildRequires: python3-gevent BuildRequires: python3-greenlet BuildRequires: python3-mock BuildRequires: python3-py BuildRequires: python3-pytest BuildRequires: python3-requests BuildRequires: python3-six BuildRequires: python3-sphinx BuildRequires: python3-werkzeug #BuildRequires: python3-zmq Requires: python3-funcsigs Requires: python3-gevent Requires: python3-greenlet Requires: python3-requests Requires: python3-six Requires: python3-werkzeug #Requires: python3-zmq %description -n python3-%{library} tinyrpc is a library for making and handling RPC calls in python. %package -n python3-%{library}-tests Summary: Tests for python-tinyrpc library Requires: python3-funcsigs Requires: python3-gevent Requires: python3-greenlet Requires: python3-mock Requires: python3-py Requires: python3-pytest Requires: python3-requests Requires: python3-six Requires: python3-werkzeug #Requires: python3-zmq Requires: python3-%{library} = %{version}-%{release} %description -n python3-%{library}-tests Tests for python-tinyrpc library %endif # with_python3 %description tinyrpc is a library for making and handling RPC calls in python. %prep %autosetup -n %{library}-%{commit} -S git sed -i -e '/^#!\//, 1d' tinyrpc/*.py tinyrpc/*/*.py tests/*.py # Let's handle dependencies ourseleves %build %if 0%{?with_python2} CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} build --executable="%{__python2} -s" %endif %if 0%{?with_python3} %py3_build %endif %if 0%{?with_python2} # generate html docs %{__python2} setup.py build_sphinx # remove the sphinx-build leftovers rm -rf build/sphinx/html/.{doctrees,buildinfo} %endif %install %if 0%{?with_python2} CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot} # Copy tests mkdir -p %{buildroot}%%{python2_sitelib}/%{library}/tests cp -r tests %{buildroot}%{python2_sitelib}/%{library}/tests %endif %if 0%{?with_python3} %py3_install # Copy tests mkdir -p %{buildroot}%%{python3_sitelib}/%{library}/tests cp -r tests %{buildroot}%{python3_sitelib}/%{library}/tests %endif %check export PYTHONPATH=. %if 0%{?with_python2} py.test -rs %endif %if 0%{?with_python3} py.test-3 -rs --ignore=tests/test_transport.py --ignore=tests/test_wsgi_transport.py %endif %if 0%{?with_python2} %files -n python-%{library} %license LICENSE %{python2_sitelib}/%{module} %{python2_sitelib}/%{module}-*.egg-info %exclude %{python2_sitelib}/%{module}/tests %files -n python-%{library}-tests %license LICENSE %{python2_sitelib}/%{module}/tests %files -n python-%{library}-doc %license LICENSE %doc build/sphinx/html README.rst %endif %if 0%{?with_python3} %files -n python3-%{library} %license LICENSE %{python3_sitelib}/%{module} %{python3_sitelib}/%{module}-*.egg-info %exclude %{python3_sitelib}/%{module}/tests %files -n python3-%{library}-tests %license LICENSE %{python3_sitelib}/%{module}/tests %endif # with_python3 %changelog * Thu Jan 24 2019 Javier Peña - 0.5-5.20170523git1f38ac - Enable python 3 build on RHEL 8, disable python 2 build in that case - Remove python-zmq build dependency completely * Mon May 15 2017 Lumír Balhar - 0.5-4.20170523git1f38ac - Move to the latest upstream commit - Disable non-working tests - Enable python3 subpackage * Sat Feb 11 2017 Fedora Release Engineering - 0.5-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Tue Jan 24 2017 Steve Linabery 0.5-3 - Disable runtime Requires on python-zmq so we can not ship it * Thu Jan 12 2017 Alfredo Moralejo 0.5-2 - Some fixes applied to spec. * Thu Jan 12 2017 Alfredo Moralejo 0.5-1 - Initial spec