ce0369
%if 0%{?fedora}
ce0369
%global with_python3 1
ce0369
%else
ce0369
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
ce0369
%endif
ce0369
ce0369
%global srcname urllib3
ce0369
ce0369
Name:           python-%{srcname}
ce0369
Version:        1.10.2
ce0369
Release:        5%{?dist}
ce0369
Summary:        Python HTTP library with thread-safe connection pooling and file post
ce0369
ce0369
License:        MIT
ce0369
URL:            http://urllib3.readthedocs.org/
ce0369
Source0:        http://pypi.python.org/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
ce0369
ce0369
# Patch to change default behaviour to check SSL certs for validity
ce0369
# https://bugzilla.redhat.com/show_bug.cgi?id=855320
ce0369
Patch0:         python-urllib3-default-ssl-cert-validate.patch
ce0369
ce0369
# Patch for the PoolManager instance to consider additional SSL
ce0369
# configuration when providing a pooled connection for a request.
ce0369
# https://bugzilla.redhat.com/show_bug.cgi?id=1329395
ce0369
# Upstream issue: https://github.com/shazow/urllib3/pull/830
ce0369
Patch1: key-connection-pools-off-custom-keys.patch
ce0369
ce0369
# Support IP address SAN fields.
ce0369
# https://bugzilla.redhat.com/show_bug.cgi?id=1434114
ce0369
# Upstream: https://github.com/shazow/urllib3/pull/922
ce0369
Patch2: Add-support-for-IP-address-SAN-fields.patch
ce0369
ce0369
BuildArch:      noarch
ce0369
ce0369
Requires:       ca-certificates
ce0369
ce0369
# Previously bundled things:
ce0369
Requires:       python-six
ce0369
Requires:       python-backports-ssl_match_hostname
ce0369
Requires:       python-ipaddress
ce0369
ce0369
%if 0%{?rhel} <= 6
ce0369
BuildRequires:  python-ordereddict
ce0369
Requires:       python-ordereddict
ce0369
%endif
ce0369
ce0369
BuildRequires:  python2-devel
ce0369
BuildRequires:  python-setuptools
ce0369
BuildRequires:  python-six
ce0369
BuildRequires:  python-backports-ssl_match_hostname
ce0369
BuildRequires:  python-ipaddress
ce0369
# For unittests
ce0369
#BuildRequires: python-nose
ce0369
#BuildRequires: python-tornado
ce0369
#BuildRequires: python-mock
ce0369
ce0369
%if 0%{?with_python3}
ce0369
BuildRequires:  python3-devel
ce0369
# For unittests
ce0369
BuildRequires:  python3-nose
ce0369
BuildRequires:  python3-six
ce0369
BuildRequires:  python3-tornado
ce0369
%endif # with_python3
ce0369
ce0369
%description
ce0369
Python HTTP module with connection pooling and file POST abilities.
ce0369
ce0369
%if 0%{?with_python3}
ce0369
%package -n python3-%{srcname}
ce0369
Requires:       ca-certificates
ce0369
Requires:       python3-six
ce0369
# Note: Will not run with python3 < 3.2 (unless python3-backports-ssl_match_hostname is created)
ce0369
Summary:        Python3 HTTP library with thread-safe connection pooling and file post
ce0369
%description -n python3-%{srcname}
ce0369
Python3 HTTP module with connection pooling and file POST abilities.
ce0369
%endif # with_python3
ce0369
ce0369
ce0369
%prep
ce0369
%setup -q -n %{srcname}-%{version}
ce0369
ce0369
# Drop the dummyserver tests in koji.  They fail there in real builds, but not
ce0369
# in scratch builds (weird).
ce0369
rm -rf test/with_dummyserver/
ce0369
ce0369
%patch0 -p1
ce0369
%patch1 -p1
ce0369
%patch2 -p1
ce0369
ce0369
%if 0%{?with_python3}
ce0369
rm -rf %{py3dir}
ce0369
cp -a . %{py3dir}
ce0369
%endif # with_python3
ce0369
ce0369
%build
ce0369
%{__python} setup.py build
ce0369
ce0369
%if 0%{?with_python3}
ce0369
pushd %{py3dir}
ce0369
%{__python3} setup.py build
ce0369
popd
ce0369
%endif # with_python3
ce0369
ce0369
%install
ce0369
rm -rf %{buildroot}
ce0369
%{__python} setup.py install --skip-build --root %{buildroot}
ce0369
ce0369
rm -rf %{buildroot}/%{python_sitelib}/urllib3/packages/six.py*
ce0369
rm -rf %{buildroot}/%{python_sitelib}/urllib3/packages/ssl_match_hostname/
ce0369
ce0369
mkdir -p %{buildroot}/%{python_sitelib}/urllib3/packages/
ce0369
# ovirt composes remove *.py files, leaving only *.pyc files there; this means we have to symlink
ce0369
#  six.py* to make sure urllib3.packages.six will be importable
ce0369
for i in ../../six.py{,o,c}; do
ce0369
  ln -s $i %{buildroot}/%{python_sitelib}/urllib3/packages/
ce0369
done
ce0369
ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python_sitelib}/urllib3/packages/ssl_match_hostname
ce0369
ce0369
# dummyserver is part of the unittest framework
ce0369
rm -rf %{buildroot}%{python_sitelib}/dummyserver
ce0369
ce0369
%if 0%{?with_python3}
ce0369
pushd %{py3dir}
ce0369
%{__python3} setup.py install --skip-build --root %{buildroot}
ce0369
ce0369
# dummyserver is part of the unittest framework
ce0369
rm -rf %{buildroot}%{python3_sitelib}/dummyserver
ce0369
popd
ce0369
%endif # with_python3
ce0369
ce0369
#%%check
ce0369
#nosetests
ce0369
ce0369
#%if 0%{?with_python3}
ce0369
#pushd %{py3dir}
ce0369
#nosetests-%{python3_version}
ce0369
#popd
ce0369
#%endif # with_python3
ce0369
ce0369
%files
ce0369
%doc CHANGES.rst LICENSE.txt README.rst CONTRIBUTORS.txt
ce0369
# For noarch packages: sitelib
ce0369
%{python_sitelib}/*
ce0369
ce0369
%if 0%{?with_python3}
ce0369
%files -n python3-%{srcname}
ce0369
%doc LICENSE.txt
ce0369
# For noarch packages: sitelib
ce0369
%{python3_sitelib}/*
ce0369
%endif # with_python3
ce0369
ce0369
%changelog
ce0369
* Wed Oct 11 2017 Iryna Shcherbina <ishcherb@redhat.com> - 1.10.2-5
ce0369
- Add patch to support IP address SAN fields.
ce0369
Resolves: rhbz#1434114
ce0369
ce0369
* Thu Sep 14 2017 Charalampos Stratakis <cstratak@redhat.com> - 1.10.2-4
ce0369
- Update patch to find ca_certs in the correct location.
ce0369
Resolves: rhbz#1450213
ce0369
ce0369
* Mon Jan 23 2017 Iryna Shcherbina <ishcherb@redhat.com> - 1.10.2-3
ce0369
- Fix PoolManager instance to take into account new SSL configuration
ce0369
Resolves: rhbz#1329395
ce0369
ce0369
* Mon Jul 27 2015 bkabrda <bkabrda@redhat.com> - 1.10.2-2
ce0369
- Fix the way we unbundle six to make ovirt work even when they remove .py files
ce0369
Resolves: rhbz#1247093
ce0369
ce0369
* Mon Apr 13 2015 Matej Stuchlik <mstuchli@redhat.com> - 1.10.2-1
ce0369
- Update to 1.10.2
ce0369
Resolves: rhbz#1226901
ce0369
ce0369
* Fri Mar  1 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-5
ce0369
- Unbundling finished!
ce0369
ce0369
* Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4
ce0369
- Upstream patch to fix Accept header when behind a proxy.
ce0369
- Reorganize patch numbers to more clearly distinguish them.
ce0369
ce0369
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.5-3
ce0369
- Renamed patches to python-urllib3-*
ce0369
- Fixed ssl check patch to use the correct cert path for Fedora.
ce0369
- Included dependency on ca-certificates
ce0369
- Cosmetic indentation changes to the .spec file.
ce0369
ce0369
* Tue Feb  5 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-2
ce0369
- python3-tornado BR and run all unittests on python3
ce0369
ce0369
* Mon Feb 04 2013 Toshio Kuratomi <toshio@fedoraproject.org> 1.5-1
ce0369
- Initial fedora build.
ce0369