diff --git a/python-urllib3.changes b/python-urllib3.changes index 681ab3f..1dab00d 100644 --- a/python-urllib3.changes +++ b/python-urllib3.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed May 29 08:20:27 UTC 2019 - Tomáš Chvátal + +- Unbundle the six, rfc3986, and backports.ssl_match_hostname + ------------------------------------------------------------------- Fri May 24 19:16:21 UTC 2019 - Tomáš Chvátal diff --git a/python-urllib3.spec b/python-urllib3.spec index de77ab2..c3f69ba 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -34,17 +34,22 @@ License: MIT Group: Development/Languages/Python URL: http://urllib3.readthedocs.org/ 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 # 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 -Patch4: python-urllib3-recent-date.patch +Patch1: python-urllib3-recent-date.patch # for SSL module on older distros BuildRequires: %{oldpython} BuildRequires: %{python_module PySocks} BuildRequires: %{python_module psutil} +BuildRequires: %{python_module rfc3986} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module six} BuildRequires: fdupes +BuildRequires: python-backports.ssl_match_hostname BuildRequires: python-rpm-macros BuildRequires: python2-ipaddress #!BuildIgnore: python-requests @@ -52,7 +57,12 @@ Requires: ca-certificates-mozilla Requires: python-cryptography Requires: python-idna Requires: python-pyOpenSSL +Requires: python-rfc3986 +Requires: python-six BuildArch: noarch +%ifpython2 +Requires: python-backports.ssl_match_hostname +%endif %if %{with test} BuildRequires: %{python_module brotlipy} BuildRequires: %{python_module idna} @@ -87,22 +97,58 @@ Highlights %prep %setup -q -n urllib3-%{version} -%patch2 -p1 -%patch4 -p1 +%autopatch -p1 find . -type f -exec chmod a-x '{}' \; 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 %python_build %install %if !%{with test} %python_install + %{python_expand \ $python -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 %check diff --git a/ssl_match_hostname_py3.py b/ssl_match_hostname_py3.py new file mode 100644 index 0000000..963d16e --- /dev/null +++ b/ssl_match_hostname_py3.py @@ -0,0 +1 @@ +from ssl import match_hostname, CertificateError