From 73558d798e2eb5e164b83fda5fca13ea9dc7ac1838e9c3464ebbc03f4c7343ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 16 Sep 2019 09:17:18 +0000 Subject: [PATCH 1/2] Accepting request 731209 from home:jayvdb:py3only Allow building only python3 OBS-URL: https://build.opensuse.org/request/show/731209 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3?expand=0&rev=82 --- python-urllib3.changes | 5 +++++ python-urllib3.spec | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/python-urllib3.changes b/python-urllib3.changes index 68c7bc5..602d121 100644 --- a/python-urllib3.changes +++ b/python-urllib3.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sat Sep 14 02:58:42 UTC 2019 - John Vandenberg + +- Use have/skip_python2/3 macros to allow building only one flavour + ------------------------------------------------------------------- Mon Jul 22 07:54:44 UTC 2019 - Tomáš Chvátal diff --git a/python-urllib3.spec b/python-urllib3.spec index 7563710..276c03b 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -42,16 +42,20 @@ 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 Patch1: python-urllib3-recent-date.patch # for SSL module on older distros +%if 0%{?suse_version} < 1500 BuildRequires: %{oldpython} +%endif 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 +%if 0%{?have_python2} && ! 0%{?skip_python2} +BuildRequires: python-backports.ssl_match_hostname BuildRequires: python2-ipaddress +%endif #!BuildIgnore: python-requests Requires: ca-certificates-mozilla Requires: python-cryptography @@ -121,6 +125,7 @@ $python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urlli $python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/urllib3/ } +%if 0%{?have_python2} && ! 0%{?skip_python2} # Unbundle the Python 2 build rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname/ @@ -134,6 +139,9 @@ 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 +%endif + +%if 0%{?have_python3} && ! 0%{?skip_python3} # Unbundle the Python 3 build rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/six* @@ -149,11 +157,12 @@ 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 +%endif %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif -%if ! %{with test} +%if ! %{with test} && "%{python_flavor}" == "python2" %pre -n python2-urllib3 SITELIB=%{python2_sitelib} CONFLICTED="${SITELIB}/urllib3/packages/ssl_match_hostname" From b6f362969cf5e513ed5c03b782391537ad5f8f3d2ad5849e16f26e57bbfd98e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 17 Sep 2019 08:54:27 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3?expand=0&rev=83 --- python-urllib3.spec | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/python-urllib3.spec b/python-urllib3.spec index 276c03b..afa79c8 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -26,13 +26,14 @@ %define psuffix %{nil} %bcond_with test %endif +%bcond_without python2 Name: python-urllib3%{psuffix} Version: 1.25.3 Release: 0 Summary: HTTP library with thread-safe connection pooling, file post, and more License: MIT Group: Development/Languages/Python -URL: http://urllib3.readthedocs.org/ +URL: https://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 @@ -41,10 +42,6 @@ Source1: ssl_match_hostname_py3.py 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 Patch1: python-urllib3-recent-date.patch -# for SSL module on older distros -%if 0%{?suse_version} < 1500 -BuildRequires: %{oldpython} -%endif BuildRequires: %{python_module PySocks} BuildRequires: %{python_module psutil} BuildRequires: %{python_module rfc3986} @@ -52,10 +49,6 @@ BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros -%if 0%{?have_python2} && ! 0%{?skip_python2} -BuildRequires: python-backports.ssl_match_hostname -BuildRequires: python2-ipaddress -%endif #!BuildIgnore: python-requests Requires: ca-certificates-mozilla Requires: python-cryptography @@ -64,6 +57,14 @@ Requires: python-pyOpenSSL Requires: python-rfc3986 Requires: python-six BuildArch: noarch +# for SSL module on older distros +%if 0%{?suse_version} < 1500 +BuildRequires: %{oldpython} +%endif +%if %{with python2} +BuildRequires: python-backports.ssl_match_hostname +BuildRequires: python-ipaddress +%endif %ifpython2 Requires: python-backports.ssl_match_hostname %endif