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
This commit is contained in:
Tomáš Chvátal 2019-09-16 09:17:18 +00:00 committed by Git OBS Bridge
parent 989fc13247
commit 73558d798e
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Sep 14 02:58:42 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Use have/skip_python2/3 macros to allow building only one flavour
-------------------------------------------------------------------
Mon Jul 22 07:54:44 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -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"