2013-07-14 04:53:22 +00:00
#
# spec file for package python-urllib3
#
2020-02-09 10:12:39 +00:00
# Copyright (c) 2020 SUSE LLC
2013-07-14 04:53:22 +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.
2018-11-01 14:22:21 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2014-03-20 15:22:29 +00:00
#
2013-07-14 04:53:22 +00:00
2017-04-06 15:11:12 +00:00
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
2020-04-21 18:33:32 +00:00
%define skip_python2 1
2018-08-21 11:39:39 +00:00
%define oldpython python
2018-09-11 13:45:03 +00:00
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
2019-05-06 11:21:12 +00:00
%define psuffix -test
2018-09-11 13:45:03 +00:00
%bcond_without test
%else
2019-05-06 11:21:12 +00:00
%define psuffix %{nil}
2018-09-11 13:45:03 +00:00
%bcond_with test
%endif
2019-05-06 11:21:12 +00:00
Name : python-urllib3%{psuffix}
2020-08-04 16:10:31 +00:00
Version : 1.25.10
2013-07-14 04:53:22 +00:00
Release : 0
Summary : HTTP library with thread-safe connection pooling, file post, and more
2014-03-20 15:22:29 +00:00
License : MIT
2013-07-14 04:53:22 +00:00
Group : Development/Languages/Python
2019-09-17 08:54:27 +00:00
URL : https://urllib3.readthedocs.org/
2017-04-06 15:11:12 +00:00
Source : https://files.pythonhosted.org/packages/source/u/urllib3/urllib3-%{version} .tar.gz
2019-05-29 08:26:07 +00:00
# Wrapper for ssl to unbundle ssl_match_hostname
Source1 : ssl_match_hostname_py3.py
2018-09-11 13:45:03 +00:00
BuildRequires : %{python_module setuptools}
2019-05-29 08:26:07 +00:00
BuildRequires : %{python_module six}
2018-07-15 22:34:22 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
2019-05-06 11:21:12 +00:00
#!BuildIgnore: python-requests
Requires : ca-certificates-mozilla
2019-09-20 12:34:26 +00:00
Requires : python-certifi
Requires : python-cryptography >= 1.3.4
Requires : python-idna >= 2.0.0
2019-05-06 11:21:12 +00:00
Requires : python-pyOpenSSL
2019-10-15 11:08:55 +00:00
Requires : python-six >= 1.12.0
2019-05-06 11:21:12 +00:00
BuildArch : noarch
2019-09-17 08:54:27 +00:00
# for SSL module on older distros
%if 0%{?suse_version} < 1500
BuildRequires : %{oldpython}
%endif
2018-09-11 13:45:03 +00:00
%if %{with test}
2019-09-20 12:34:26 +00:00
BuildRequires : %{python_module PySocks}
BuildRequires : %{python_module brotlipy >= 0.6.0}
BuildRequires : %{python_module certifi}
BuildRequires : %{python_module cryptography >= 1.3.4}
BuildRequires : %{python_module idna >= 2.0.0}
2018-09-11 13:45:03 +00:00
BuildRequires : %{python_module mock >= 1.3.0}
2019-09-20 12:34:26 +00:00
BuildRequires : %{python_module psutil}
BuildRequires : %{python_module pytest}
2019-10-15 11:08:55 +00:00
BuildRequires : %{python_module six >= 1.12.0}
2019-09-27 10:41:51 +00:00
BuildRequires : %{python_module tornado < 6}
2020-02-09 10:12:39 +00:00
BuildRequires : %{python_module trustme >= 0.5.3}
2019-04-23 10:39:55 +00:00
BuildRequires : %{python_module urllib3 >= %{version} }
2018-09-11 13:45:03 +00:00
%endif
2019-09-20 12:34:26 +00:00
Recommends: python-PySocks >= 1.5.6
Recommends: python-brotlipy >= 0.6.0
2017-04-06 15:11:12 +00:00
%python_subpackages
2013-07-14 04:53:22 +00:00
%description
Highlights
- Re-use the same socket connection for multiple requests
(HTTPConnectionPool and HTTPSConnectionPool)
(with optional client-side certificate verification).
- File posting (encode_multipart_formdata).
- Built-in redirection and retries (optional).
- Supports gzip and deflate decoding.
- Thread-safe and sanity-safe.
- Works with AppEngine, gevent, and eventlib.
- Tested on Python 2.6+ and Python 3.3+, 100% unit test coverage.
- Small and easy to understand codebase perfect for extending and building upon.
For a more comprehensive solution, have a look at
Requests which is also powered by urllib3.
%prep
%setup -q -n urllib3-%{version}
2018-07-15 22:34:22 +00:00
find . -type f -exec chmod a-x '{}' \;
2019-04-23 10:39:55 +00:00
find . -name __pycache__ -type d -exec rm -fr {} +
2013-07-14 04:53:22 +00:00
2019-05-29 08:26:07 +00:00
# Drop the dummyserver tests, they fail in OBS
rm test/with_dummyserver/test_proxy_poolmanager.py
rm test/with_dummyserver/test_poolmanager.py
# Don't run the Google App Engine tests
rm -r test/appengine/
2013-07-14 04:53:22 +00:00
%build
2017-04-06 15:11:12 +00:00
%python_build
2013-07-14 04:53:22 +00:00
%install
2019-04-23 10:39:55 +00:00
%if !%{with test}
2017-04-06 15:11:12 +00:00
%python_install
2019-05-29 08:26:07 +00:00
2018-09-11 13:45:03 +00:00
%{python_expand \
$python -m compileall -d %{$python_sitelib} %{buildroot} %{$python_sitelib}/urllib3/
$python -O -m compileall -d %{$python_sitelib} %{buildroot} %{$python_sitelib}/urllib3/
}
2019-05-29 08:26:07 +00:00
# Unbundle the Python 3 build
rm -rf %{buildroot} /%{python3_sitelib} /urllib3/packages/six.py*
rm -rf %{buildroot} /%{python3_sitelib} /urllib3/packages/__pycache__/six*
rm -rf %{buildroot} /%{python3_sitelib} /urllib3/packages/ssl_match_hostname/
mkdir -p %{buildroot} /%{python3_sitelib} /urllib3/packages/
cp -a %{SOURCE1} %{buildroot} /%{python3_sitelib} /urllib3/packages/ssl_match_hostname.py
ln -s %{python3_sitelib} /six.py %{buildroot} /%{python3_sitelib} /urllib3/packages/six.py
ln -s %{python3_sitelib} /__pycache__/six.cpython-%{python3_version_nodots} .opt-1.pyc \
%{buildroot} /%{python3_sitelib} /urllib3/packages/__pycache__/
ln -s %{python3_sitelib} /__pycache__/six.cpython-%{python3_version_nodots} .pyc \
%{buildroot} /%{python3_sitelib} /urllib3/packages/__pycache__/
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2019-04-23 10:39:55 +00:00
%endif
2013-07-14 04:53:22 +00:00
2018-09-11 13:45:03 +00:00
%if %{with test}
2019-06-20 08:59:49 +00:00
%check
2020-06-05 05:27:55 +00:00
skiplist='not test_select_interrupt_exception and not test_selector_error and not timeout and not test_request_host_header_ignores_fqdn_dot and not test_dotted_fqdn and not TestImportWithoutSSL and not test_ssl_failed_fingerprint_verification'
2018-02-12 12:38:45 +00:00
case $(uname -m) in
ppc*)
skiplist=" $ s k i p l i s t a n d n o t t e s t _ s e l e c t _ t i m i n g a n d n o t t e s t _ s e l e c t _ m u l t i p l e _ i n t e r r u p t s _ w i t h _ e v e n t a n d n o t t e s t _ i n t e r r u p t _ w a i t _ f o r _ r e a d _ w i t h _ e v e n t a n d n o t t e s t _ s e l e c t _ i n t e r r u p t _ w i t h _ e v e n t " ;;
esac
2019-05-29 08:59:51 +00:00
# the certificate validation is much stricter in new openssl so skip
# tests which would not validate it
skiplist=" $ s k i p l i s t a n d n o t t e s t _ c l i e n t _ n o _ i n t e r m e d i a t e "
2018-02-12 12:38:45 +00:00
2019-04-23 10:39:55 +00:00
export PYTHONDONTWRITEBYTECODE=1
2019-09-20 12:34:26 +00:00
export LANG=" e n _ U S . U T F 8 "
2019-05-29 07:57:50 +00:00
%pytest -k " $ { s k i p l i s t } "
2018-09-11 13:45:03 +00:00
%endif
2015-10-14 09:37:35 +00:00
2019-04-23 10:39:55 +00:00
%if ! %{with test}
2017-04-06 15:11:12 +00:00
%files %{python_files}
2018-07-15 22:34:22 +00:00
%license LICENSE.txt
%doc CHANGES.rst CONTRIBUTORS.txt README.rst
2014-03-20 15:22:29 +00:00
%{python_sitelib} /urllib3
2015-10-14 09:37:35 +00:00
%{python_sitelib} /urllib3-%{version} -py*.egg-info
2018-09-11 13:45:03 +00:00
%endif
2013-07-14 04:53:22 +00:00
2014-03-20 15:22:29 +00:00
%changelog