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}
7b76a2
Version:        1.5
b65482
Release:        8%{?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
7b76a2
### TODO: Send this to upstream urllib3
7b76a2
# make all imports of things in packages try system copies first
7b76a2
Patch1:         python-urllib3-unbundle.patch
7b76a2
7b76a2
# Fix accept header when behind a proxy
7b76a2
#https://github.com/shazow/urllib3/pull/93
7b76a2
#https://github.com/shazow/urllib3/pull/93.patch
7b76a2
Patch2:         python-urllib3-accept-header-for-proxy.patch
7b76a2
7b76a2
# Remove logging-clear-handlers from setup.cfg because it's not available in RHEL6's nose
7b76a2
Patch100:       python-urllib3-old-nose-compat.patch
7b76a2
### TODO: Send this upstream
7b76a2
# Compatibility with python-2.6's unittest
7b76a2
Patch101:         python-urllib3-py2.6-compat.patch
7b76a2
7b76a2
BuildArch:      noarch
7b76a2
7b76a2
Requires:       ca-certificates
7b76a2
Requires:       python-six
7b76a2
7b76a2
Requires: python-backports-ssl_match_hostname
b65482
%if 0%{?rhel} && 0%{?rhel} <= 6
7b76a2
BuildRequires:  python-ordereddict
7b76a2
Requires:       python-ordereddict
7b76a2
%endif
7b76a2
7b76a2
BuildRequires:  python2-devel
7b76a2
# For unittests
7b76a2
BuildRequires:  python-nose
7b76a2
BuildRequires:  python-six
7b76a2
BuildRequires:  python-tornado
7b76a2
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
7b76a2
rm -rf urllib3/packages/
7b76a2
7b76a2
%patch0 -p1
7b76a2
%patch1 -p1
7b76a2
%patch2 -p1
7b76a2
%if 0%{?rhel} && 0%{?rhel} <= 6
7b76a2
%patch100 -p1
7b76a2
%patch101 -p1
7b76a2
%endif
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
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
7b76a2
%check
7b76a2
nosetests
7b76a2
7b76a2
%if 0%{?with_python3}
7b76a2
pushd %{py3dir}
7b76a2
nosetests-%{python3_version}
7b76a2
popd
7b76a2
%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
b65482
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.5-8
b65482
- Mass rebuild 2013-12-27
7b76a2
b65482
* Tue Jun 11 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-6
b65482
- Fix Requires of python-ordereddict to only apply to RHEL
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