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