14
0

- Unbundle the six, rfc3986, and backports.ssl_match_hostname

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3?expand=0&rev=65
This commit is contained in:
Tomáš Chvátal
2019-05-29 08:26:07 +00:00
committed by Git OBS Bridge
parent b0e8647f51
commit b5dc6c76c3
3 changed files with 57 additions and 5 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed May 29 08:20:27 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Unbundle the six, rfc3986, and backports.ssl_match_hostname
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 24 19:16:21 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com> Fri May 24 19:16:21 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -34,17 +34,22 @@ License: MIT
Group: Development/Languages/Python Group: Development/Languages/Python
URL: http://urllib3.readthedocs.org/ URL: http://urllib3.readthedocs.org/
Source: https://files.pythonhosted.org/packages/source/u/urllib3/urllib3-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/u/urllib3/urllib3-%{version}.tar.gz
# Wrapper for ssl to unbundle ssl_match_hostname
Source1: ssl_match_hostname_py3.py
# PATCH-FEATURE-UPSTREAM -- use set_default_verify_paths() if no certificate path is supplied # PATCH-FEATURE-UPSTREAM -- use set_default_verify_paths() if no certificate path is supplied
# should be removed in the future, see SR#437853 # should be removed in the future, see SR#437853
Patch2: urllib3-ssl-default-context.patch Patch0: urllib3-ssl-default-context.patch
# PATCH-FIX-UPSTREAM python-urllib3-recent-date.patch gh#shazow/urllib3#1303, boo#1074247 dimstar@opensuse.org -- Fix test suite, use correct date # PATCH-FIX-UPSTREAM python-urllib3-recent-date.patch gh#shazow/urllib3#1303, boo#1074247 dimstar@opensuse.org -- Fix test suite, use correct date
Patch4: python-urllib3-recent-date.patch Patch1: python-urllib3-recent-date.patch
# for SSL module on older distros # for SSL module on older distros
BuildRequires: %{oldpython} BuildRequires: %{oldpython}
BuildRequires: %{python_module PySocks} BuildRequires: %{python_module PySocks}
BuildRequires: %{python_module psutil} BuildRequires: %{python_module psutil}
BuildRequires: %{python_module rfc3986}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-backports.ssl_match_hostname
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: python2-ipaddress BuildRequires: python2-ipaddress
#!BuildIgnore: python-requests #!BuildIgnore: python-requests
@@ -52,7 +57,12 @@ Requires: ca-certificates-mozilla
Requires: python-cryptography Requires: python-cryptography
Requires: python-idna Requires: python-idna
Requires: python-pyOpenSSL Requires: python-pyOpenSSL
Requires: python-rfc3986
Requires: python-six
BuildArch: noarch BuildArch: noarch
%ifpython2
Requires: python-backports.ssl_match_hostname
%endif
%if %{with test} %if %{with test}
BuildRequires: %{python_module brotlipy} BuildRequires: %{python_module brotlipy}
BuildRequires: %{python_module idna} BuildRequires: %{python_module idna}
@@ -87,22 +97,58 @@ Highlights
%prep %prep
%setup -q -n urllib3-%{version} %setup -q -n urllib3-%{version}
%patch2 -p1 %autopatch -p1
%patch4 -p1
find . -type f -exec chmod a-x '{}' \; find . -type f -exec chmod a-x '{}' \;
find . -name __pycache__ -type d -exec rm -fr {} + find . -name __pycache__ -type d -exec rm -fr {} +
# 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/
%build %build
%python_build %python_build
%install %install
%if !%{with test} %if !%{with test}
%python_install %python_install
%{python_expand \ %{python_expand \
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/ $python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/ $python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/
%fdupes %{buildroot}%{$python_sitelib}
} }
# 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}
%endif %endif
%check %check

View File

@@ -0,0 +1 @@
from ssl import match_hostname, CertificateError