#
# Conditional build:
-%bcond_without doc # don't build doc
-%bcond_without tests # do not perform "make test"
+%bcond_with tests # py.test tests [use network]
%bcond_without python2 # CPython 2.x module
-%bcond_with python3 # CPython 3.x module
+%bcond_without python3 # CPython 3.x module
%define module geventhttpclient
Summary: A high performance, concurrent HTTP client library
+Summary(pl.UTF-8): Biblioteka bardzo wydajnego, wielowątkowego klienta HTTP
Name: python-%{module}
-Version: 1.2.0
+# keep 1.x here for python2 support
+Version: 1.5.5
Release: 1
License: MIT
Group: Libraries/Python
-Source0: https://pypi.python.org/packages/source/g/geventhttpclient/geventhttpclient-%{version}.tar.gz
-# Source0-md5: 1b3070e09b6e50fce929771f3f4fc9a6
-URL: https://pypi.python.org/pypi/geventhttpclient
-BuildRequires: python-gevent
+#Source0Download: https://pypi.org/simple/geventhttpclient/
+Source0: https://files.pythonhosted.org/packages/source/g/geventhttpclient/geventhttpclient-%{version}.tar.gz
+# Source0-md5: 921c99dae79636616b4826423a870c9a
+URL: https://pypi.org/project/geventhttpclient/
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.710
+BuildRequires: rpmbuild(macros) >= 1.714
%if %{with python2}
-BuildRequires: python-devel
+# older versions generate pythonegg(backports.ssl_match_hostname) dependency
+BuildRequires: python-devel >= 1:2.7.9
+BuildRequires: python-modules >= 1:2.7.9
BuildRequires: python-setuptools
%if %{with tests}
+BuildRequires: python-brotli
BuildRequires: python-certifi
+BuildRequires: python-dpkt
+BuildRequires: python-gevent >= 0.13
+BuildRequires: python-pytest
+BuildRequires: python-six
%endif
%endif
%if %{with python3}
-BuildRequires: python3-devel
-BuildRequires: python3-modules
+BuildRequires: python3-devel >= 1:3.4
+BuildRequires: python3-modules >= 1:3.4
BuildRequires: python3-setuptools
%if %{with tests}
+BuildRequires: python3-brotli
BuildRequires: python3-certifi
+BuildRequires: python3-dpkt
+BuildRequires: python3-gevent >= 0.13
+BuildRequires: python3-pytest
+BuildRequires: python3-six
%endif
%endif
-Requires: python-modules
+Requires: python-modules >= 1:2.7.9
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-A high performance, concurrent HTTP client library for Python using
+A high performance, concurrent HTTP client library for Python 2 using
gevent.
geventhttpclient use a fast HTTP parser, written in C, originating
Safe SSL support is provided by default.
+%description -l pl.UTF-8
+Biblioteka bardzo wydajnego, wielowątkowego klienta HTTP dla Pythona
+2, wykorzystująca gevent.
+
+geventhttpclient wykorzystuje szybki parser HTTP, napisany w C,
+pochodzący z serwera nginx, wyciągniety i zmodyfikowany przez Joyenta.
+
+geventhttpclient został zaprojektowany w szczególności z myślą o
+dużym zrównolegleniu, przesyłaniu strumieni i obsłudze trwałych
+połączeń HTTP 1.1. Bardziej ogólnie, jest przeznaczony do wydajnego
+pobierania z API REST-owych oraz strumieniowych, takich jak Twitter.
+
+Domyślnie dostępna jest obsługa bezpiecznego SSL.
+
%package -n python3-%{module}
Summary: A high performance, concurrent HTTP client library
+Summary(pl.UTF-8): Biblioteka bardzo wydajnego, wielowątkowego klienta HTTP
Group: Libraries/Python
-Requires: python3-modules
+Requires: python3-modules >= 1:3.4
%description -n python3-%{module}
-A high performance, concurrent HTTP client library for Python using
+A high performance, concurrent HTTP client library for Python 3 using
gevent.
geventhttpclient use a fast HTTP parser, written in C, originating
Safe SSL support is provided by default.
+%description -n python3-%{module} -l pl.UTF-8
+Biblioteka bardzo wydajnego, wielowątkowego klienta HTTP dla Pythona
+3, wykorzystująca gevent.
+
+geventhttpclient wykorzystuje szybki parser HTTP, napisany w C,
+pochodzący z serwera nginx, wyciągniety i zmodyfikowany przez Joyenta.
+
+geventhttpclient został zaprojektowany w szczególności z myślą o
+dużym zrównolegleniu, przesyłaniu strumieni i obsłudze trwałych
+połączeń HTTP 1.1. Bardziej ogólnie, jest przeznaczony do wydajnego
+pobierania z API REST-owych oraz strumieniowych, takich jak Twitter.
+
+Domyślnie dostępna jest obsługa bezpiecznego SSL.
+
%prep
%setup -q -n %{module}-%{version}
+%{__rm} -r src/geventhttpclient.egg-info
+
%build
%if %{with python2}
-CC="%{__cc}" \
-CFLAGS="%{rpmcppflags} %{rpmcflags}" \
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd)/$(echo build-2/lib.*) \
+%{__python} -m pytest src
+%endif
%endif
%if %{with python3}
-CC="%{__cc}" \
-CFLAGS="%{rpmcppflags} %{rpmcflags}" \
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd)/$(echo build-3/lib.*) \
+%{__python3} -m pytest src
+%endif
%endif
%install
%if %{with python2}
%files
%defattr(644,root,root,755)
+%doc LICENSE.txt README.mdown
%dir %{py_sitedir}/geventhttpclient
%{py_sitedir}/geventhttpclient/*.py[co]
-%attr(755,root,root) %{py_sitedir}/geventhttpclient/*.so
-%{py_sitedir}/%{module}-%{version}-py*.egg-info
+%attr(755,root,root) %{py_sitedir}/geventhttpclient/_parser.so
+%{py_sitedir}/geventhttpclient-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-%doc AUTHORS CHANGES LICENSE
-%{py3_sitedir}/%{module}
-%{py3_sitedir}/%{module}-%{version}-py*.egg-info
+%doc LICENSE.txt README.mdown
+%dir %{py3_sitedir}/geventhttpclient
+%{py3_sitedir}/geventhttpclient/*.py
+%{py3_sitedir}/geventhttpclient/__pycache__
+%attr(755,root,root) %{py3_sitedir}/geventhttpclient/_parser.cpython-*.so
+%{py3_sitedir}/geventhttpclient-%{version}-py*.egg-info
%endif