2019-04-11 09:59:14 +00:00
#
# spec file for package python-hyper
#
2021-05-17 13:18:32 +00:00
# Copyright (c) 2021 SUSE LLC
2019-04-11 09:59:14 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
2020-04-23 11:00:11 +00:00
%bcond_without python2
2021-05-17 13:18:32 +00:00
%bcond_without python36
2019-04-11 09:59:14 +00:00
Name : python-hyper
2021-12-31 09:49:29 +00:00
Version : 0.7.0+git89.b77e758
2019-04-11 09:59:14 +00:00
Release : 0
Summary : HTTP/2 Client for Python
License : MIT
Group : Development/Languages/Python
URL : https://github.com/Lukasa/hyper
Source0 : hyper-%{version} .tar.xz
Patch0 : fix-dependencies.patch
Patch1 : fix-test.patch
Patch2 : pr-402-h2-settings-fix.patch
Patch3 : tests-mark-rpmfail_getaddrinfo.patch
2019-06-21 11:51:13 +00:00
Patch4 : fix-j1-tests.patch
2019-09-17 09:59:10 +00:00
Patch5 : http20.patch
2022-01-10 09:01:39 +00:00
Patch6 : py310.patch
2019-04-11 09:59:14 +00:00
BuildRequires : %{python_module brotlipy >= 0.7.0}
BuildRequires : %{python_module h2 > 2.5.0}
BuildRequires : %{python_module hyperframe >= 3.2}
BuildRequires : %{python_module mock}
BuildRequires : %{python_module packaging}
2021-12-31 09:49:29 +00:00
BuildRequires : %{python_module pyOpenSSL}
2019-04-11 09:59:14 +00:00
BuildRequires : %{python_module pytest >= 3.0}
BuildRequires : %{python_module requests}
BuildRequires : %{python_module rfc3986 >= 1.1.0}
BuildRequires : %{python_module setuptools}
BuildRequires : fdupes
BuildRequires : python-rpm-macros
2021-12-31 09:49:29 +00:00
BuildRequires : openssl(cli)
2019-04-11 09:59:14 +00:00
Requires : python-brotlipy >= 0.7.0
Requires : python-h2 > 2.5.0
Requires : python-hyperframe >= 3.2
Requires : python-rfc3986 >= 1.1.0
2020-05-25 13:34:30 +00:00
Requires(post) : update-alternatives
2021-05-17 13:18:32 +00:00
Requires(postun) : update-alternatives
2020-04-23 11:00:11 +00:00
%if %{with python2}
BuildRequires : python-enum34 >= 1.0.4
BuildRequires : python-futures
%endif
2019-04-11 09:59:14 +00:00
%if python2
Requires : python-enum34
%endif
%python_subpackages
%description
hyper supports the final draft of the HTTP/2 specification: additionally,
it provides support for drafts 14, 15, and 16 of the HTTP/2 specification.
It also supports the final draft of the HPACK specification.
2019-04-11 10:01:24 +00:00
hyper is intended to be a drop-in replacement for http.client, with a
2019-04-11 09:59:14 +00:00
similar API. However, hyper intentionally does not name its classes the
same way http.client does. This is because most servers do not support
HTTP/2 at this time: I don't want you accidentally using hyper when you
wanted http.client.
%prep
%setup -q -n hyper-%{version}
%autopatch -p1
%build
%python_build
%install
%python_install
2020-05-25 13:34:30 +00:00
%python_clone -a %{buildroot} %{_bindir} /hyper
2019-04-11 09:59:14 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitelib}
%check
2021-10-20 05:56:16 +00:00
# Regenerate test certificates to avoid SSLError EE_KEY_TOO_SMALL
openssl req -x509 -newkey rsa:4096 -keyout test/certs/server.key -out test/certs/server.crt -days 365 -nodes -batch
openssl req -x509 -newkey rsa:4096 -keyout test/certs/client.key -out test/certs/client.crt -days 365 -nodes -batch
openssl req -x509 -newkey rsa:4096 -keyout test/certs/nopassword.pem -out test/certs/nopassword.pem -days 365 -nodes -batch
2019-06-04 14:34:34 +00:00
# test_HTTPConnection_with_custom_context - TLS 1.3 does not support h2
2019-09-17 09:59:10 +00:00
# test_useful_error_with_no_protocol test_goaway_frame_PROTOCOL_ERROR test_goaway_frame_HTTP_1_1_REQUIRED test_goaway_frame_invalid_error_code - httplib update changed error messages reported
2021-02-26 21:48:30 +00:00
# test_we_can_read_from_the_socket and test_connection_no_window_update_on_zero_length_data_frame fail due to updated dependencies
2021-10-20 05:56:16 +00:00
# test_client_certificate[context_kwargs1] failures seen on py36 and i586
# test_insecure_proxy_connection known flaky test
%pytest -rs -k 'not (rpmfail_getaddrinfo or test_HTTPConnection_with_custom_context or test_useful_error_with_no_protocol or test_goaway_frame_PROTOCOL_ERROR or test_goaway_frame_HTTP_1_1_REQUIRED or test_goaway_frame_invalid_error_code or test_we_can_read_from_the_socket or test_connection_no_window_update_on_zero_length_data_frame or test_set_url_info or (test_client_certificate and context_kwargs1) or test_insecure_proxy_connection)' test/
2019-04-11 09:59:14 +00:00
2020-05-25 13:34:30 +00:00
%post
%python_install_alternative hyper
%postun
%python_uninstall_alternative hyper
2019-04-11 09:59:14 +00:00
%files %{python_files}
%license LICENSE
%doc README.rst
2020-05-25 13:34:30 +00:00
%python_alternative %{_bindir} /hyper
2019-04-11 09:59:14 +00:00
%{python_sitelib} /hyper*
%changelog