2013-07-14 04:53:22 +00:00
#
# spec file for package python-urllib3
#
2019-04-17 22:10:22 +00:00
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
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-%{**}}
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}
2019-05-29 07:57:50 +00:00
Version : 1.25.3
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
2018-07-15 22:34:22 +00:00
URL : http://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
2015-11-13 14:47:50 +00:00
# PATCH-FEATURE-UPSTREAM -- use set_default_verify_paths() if no certificate path is supplied
2017-04-06 15:11:12 +00:00
# should be removed in the future, see SR#437853
2019-05-29 08:26:07 +00:00
Patch0 : urllib3-ssl-default-context.patch
2017-12-31 15:41:16 +00:00
# PATCH-FIX-UPSTREAM python-urllib3-recent-date.patch gh#shazow/urllib3#1303, boo#1074247 dimstar@opensuse.org -- Fix test suite, use correct date
2019-05-29 08:26:07 +00:00
Patch1 : python-urllib3-recent-date.patch
2019-05-06 11:21:12 +00:00
# for SSL module on older distros
BuildRequires : %{oldpython}
2017-04-06 15:11:12 +00:00
BuildRequires : %{python_module PySocks}
BuildRequires : %{python_module psutil}
2019-05-29 08:26:07 +00:00
BuildRequires : %{python_module rfc3986}
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
2019-05-29 08:26:07 +00:00
BuildRequires : python-backports.ssl_match_hostname
2018-07-15 22:34:22 +00:00
BuildRequires : python-rpm-macros
2019-05-06 11:21:12 +00:00
BuildRequires : python2-ipaddress
#!BuildIgnore: python-requests
Requires : ca-certificates-mozilla
Requires : python-cryptography
Requires : python-idna
Requires : python-pyOpenSSL
2019-05-29 08:26:07 +00:00
Requires : python-rfc3986
Requires : python-six
2019-05-06 11:21:12 +00:00
BuildArch : noarch
2019-05-29 08:26:07 +00:00
%if python2
Requires : python-backports.ssl_match_hostname
%endif
2018-09-11 13:45:03 +00:00
%if %{with test}
2019-04-23 10:39:55 +00:00
BuildRequires : %{python_module brotlipy}
BuildRequires : %{python_module idna}
2018-09-11 13:45:03 +00:00
BuildRequires : %{python_module mock >= 1.3.0}
BuildRequires : %{python_module pytest}
BuildRequires : %{python_module tornado >= 4.2.1}
2019-04-23 10:39:55 +00:00
BuildRequires : %{python_module urllib3 >= %{version} }
2018-09-11 13:45:03 +00:00
%endif
2018-03-07 16:42:29 +00:00
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
2019-04-23 10:39:55 +00:00
Recommends: python-brotlipy
2018-03-07 16:42:29 +00:00
%endif
2018-08-20 08:14:11 +00:00
%if python2
Requires : python-ipaddress
%endif
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}
2019-05-29 08:26:07 +00:00
%autopatch -p1
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 2 build
rm -rf %{buildroot} /%{python2_sitelib} /urllib3/packages/six.py*
rm -rf %{buildroot} /%{python2_sitelib} /urllib3/packages/ssl_match_hostname/
rm -rf %{buildroot} /%{python2_sitelib} /urllib3/packages/rfc3986/
mkdir -p %{buildroot} /%{python2_sitelib} /urllib3/packages/
ln -s %{python2_sitelib} /six.py %{buildroot} /%{python2_sitelib} /urllib3/packages/six.py
ln -s %{python2_sitelib} /six.pyc %{buildroot} /%{python2_sitelib} /urllib3/packages/six.pyc
ln -s %{python2_sitelib} /six.pyo %{buildroot} /%{python2_sitelib} /urllib3/packages/six.pyo
ln -s %{python2_sitelib} /backports/ssl_match_hostname \
%{buildroot} /%{python2_sitelib} /urllib3/packages/ssl_match_hostname
ln -s %{python2_sitelib} /rfc3986/ \
%{buildroot} /%{python2_sitelib} /urllib3/packages/rfc3986
# 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/
rm -rf %{buildroot} /%{python3_sitelib} /urllib3/packages/rfc3986/
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__/
ln -s %{python3_sitelib} /rfc3986/ \
%{buildroot} /%{python3_sitelib} /urllib3/packages/rfc3986
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2019-04-23 10:39:55 +00:00
%endif
2013-07-14 04:53:22 +00:00
2015-11-13 14:47:50 +00:00
%check
2018-09-11 13:45:03 +00:00
%if %{with test}
2019-05-29 08:37:50 +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'
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 tls13 tests are not run in upstream travis and they fail for us
# lets wait for upstream to sort it out first
skiplist=" $ s k i p l i s t a n d n o t t e s t _ s e t _ s s l _ v e r s i o n _ t o _ t l s _ v e r s i o n "
# 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 "
2019-06-07 11:40:42 +00:00
# we have patch to fix source address errors in python and raise different
# error than urllib3 expects in its tests
skiplist=" $ s k i p l i s t a n d n o t t e s t _ s o u r c e _ a d d r e s s _ e r r o r "
2018-02-12 12:38:45 +00:00
2019-04-23 10:39:55 +00:00
export PYTHONDONTWRITEBYTECODE=1
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