Blob Blame History Raw
%global commit 1f38ac79ef9a224f4d84e465bcf91f71aff670db
%global shortcommit %(c=%{commit}; echo ${c:0:7})

%if 0%{?fedora} >= 24
%global with_python3 1
%endif


%global library tinyrpc
%global module tinyrpc

Name:       python-%{library}
Version:    0.5
Release:    4.20170523git1f38ac%{?dist}
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

%package -n python2-%{library}
Summary:    A modular RPC library
%{?python_provide:%python_provide python2-%{library}}

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

Requires:  python-funcsigs
Requires:  python-gevent
Requires:  python-greenlet
Requires:  python-requests
Requires:  python-six
Requires:  python-werkzeug
Requires:  python-zmq

%description -n python2-%{library}
tinyrpc is a library for making and handling RPC calls in python. 


%package -n python2-%{library}-tests
Summary:    Tests for python2-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:  python2-%{library} = %{version}-%{release}


%description -n python2-%{library}-tests
Tests for  python2-tinyrpc library

%package -n python-%{library}-doc
Summary:   Documentation for tinyrpc library


%description -n python-%{library}-doc
Documentation for tinyrpc library

%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 python2-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  python2-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
%py2_build
%if 0%{?with_python3}
%py3_build
%endif

# generate html docs
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf build/sphinx/html/.{doctrees,buildinfo}

%install
%py2_install
# Copy tests
mkdir -p %{buildroot}%%{python2_sitelib}/%{library}/tests
cp -r tests %{buildroot}%{python2_sitelib}/%{library}/tests
%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=.
py.test -rs
%if 0%{?with_python3}
py.test-3 -rs --ignore=tests/test_transport.py --ignore=tests/test_wsgi_transport.py
%endif

%files -n python2-%{library}
%license LICENSE
%{python2_sitelib}/%{module}
%{python2_sitelib}/%{module}-*.egg-info
%exclude %{python2_sitelib}/%{module}/tests

%files -n python2-%{library}-tests
%license LICENSE
%{python2_sitelib}/%{module}/tests

%files -n python-%{library}-doc
%license LICENSE
%doc build/sphinx/html README.rst

%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
* Mon May 15 2017 Lumír Balhar <lbalhar@redhat.com> - 0.5-4.20170523git1f38ac
- Move to the latest upstream commit
- Disable non-working tests
- Enable python3 subpackage

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jan 12 2017 Alfredo Moralejo <amoralej@redhat.com> 0.5-2
- Some fixes applied to spec.

* Thu Jan 12 2017 Alfredo Moralejo <amoralej@redhat.com> 0.5-1
- Initial spec