e2c2602
%if 0%{?fedora}
e2c2602
%global with_python3 1
e2c2602
%else
e2c2602
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
e2c2602
%endif
e2c2602
e2c2602
%global srcname urllib3
e2c2602
e2c2602
Name:           python-%{srcname}
e2c2602
Version:        1.5
f54a32e
Release:        6%{?dist}
e2c2602
Summary:        Python HTTP library with thread-safe connection pooling and file post
e2c2602
e2c2602
License:        MIT
e2c2602
URL:            http://urllib3.readthedocs.org/
e2c2602
Source0:        http://pypi.python.org/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
23a06f9
e2c2602
# Patch to change default behaviour to check SSL certs for validity
e2c2602
# https://bugzilla.redhat.com/show_bug.cgi?id=855320
e2c2602
Patch0:         python-urllib3-default-ssl-cert-validate.patch
23a06f9
e2c2602
### TODO: Send this to upstream urllib3
e2c2602
# make all imports of things in packages try system copies first
e2c2602
Patch1:         python-urllib3-unbundle.patch
23a06f9
23a06f9
# Fix accept header when behind a proxy
23a06f9
#https://github.com/shazow/urllib3/pull/93
23a06f9
#https://github.com/shazow/urllib3/pull/93.patch
23a06f9
Patch2:         python-urllib3-accept-header-for-proxy.patch
23a06f9
e2c2602
# Remove logging-clear-handlers from setup.cfg because it's not available in RHEL6's nose
e2c2602
Patch100:       python-urllib3-old-nose-compat.patch
23a06f9
### TODO: Send this upstream
23a06f9
# Compatibility with python-2.6's unittest
23a06f9
Patch101:         python-urllib3-py2.6-compat.patch
e2c2602
e2c2602
BuildArch:      noarch
e2c2602
e2c2602
Requires:       ca-certificates
e2c2602
Requires:       python-six
e2c2602
750fa89
Requires: python-backports-ssl_match_hostname
f54a32e
%if 0%{?rhel} && 0%{?rhel} <= 6
e2c2602
BuildRequires:  python-ordereddict
e2c2602
Requires:       python-ordereddict
e2c2602
%endif
e2c2602
e2c2602
BuildRequires:  python2-devel
e2c2602
# For unittests
e2c2602
BuildRequires:  python-nose
e2c2602
BuildRequires:  python-six
e2c2602
BuildRequires:  python-tornado
750fa89
BuildRequires: python-backports-ssl_match_hostname
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
BuildRequires:  python3-devel
e2c2602
# For unittests
e2c2602
BuildRequires:  python3-nose
e2c2602
BuildRequires:  python3-six
e2c2602
BuildRequires:  python3-tornado
e2c2602
%endif # with_python3
e2c2602
e2c2602
%description
e2c2602
Python HTTP module with connection pooling and file POST abilities.
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
%package -n python3-%{srcname}
e2c2602
Requires:       ca-certificates
e2c2602
Requires:       python3-six
e2c2602
# Note: Will not run with python3 < 3.2 (unless python3-backports-ssl_match_hostname is created)
e2c2602
Summary:        Python3 HTTP library with thread-safe connection pooling and file post
e2c2602
%description -n python3-%{srcname}
e2c2602
Python3 HTTP module with connection pooling and file POST abilities.
e2c2602
%endif # with_python3
e2c2602
e2c2602
e2c2602
%prep
e2c2602
%setup -q -n %{srcname}-%{version}
e2c2602
750fa89
rm -rf urllib3/packages/
e2c2602
e2c2602
%patch0 -p1
e2c2602
%patch1 -p1
23a06f9
%patch2 -p1
e2c2602
%if 0%{?rhel} && 0%{?rhel} <= 6
e2c2602
%patch100 -p1
23a06f9
%patch101 -p1
e2c2602
%endif
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
rm -rf %{py3dir}
e2c2602
cp -a . %{py3dir}
e2c2602
%endif # with_python3
e2c2602
e2c2602
%build
e2c2602
%{__python} setup.py build
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
pushd %{py3dir}
e2c2602
%{__python3} setup.py build
e2c2602
popd
e2c2602
%endif # with_python3
e2c2602
e2c2602
%install
e2c2602
rm -rf %{buildroot}
e2c2602
%{__python} setup.py install --skip-build --root %{buildroot}
e2c2602
e2c2602
# dummyserver is part of the unittest framework
e2c2602
rm -rf %{buildroot}%{python_sitelib}/dummyserver
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
pushd %{py3dir}
e2c2602
%{__python3} setup.py install --skip-build --root %{buildroot}
e2c2602
e2c2602
# dummyserver is part of the unittest framework
e2c2602
rm -rf %{buildroot}%{python3_sitelib}/dummyserver
e2c2602
popd
e2c2602
%endif # with_python3
e2c2602
e2c2602
%check
e2c2602
nosetests
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
pushd %{py3dir}
e2c2602
nosetests-%{python3_version}
e2c2602
popd
e2c2602
%endif # with_python3
e2c2602
e2c2602
%files
e2c2602
%doc CHANGES.rst LICENSE.txt README.rst CONTRIBUTORS.txt
e2c2602
# For noarch packages: sitelib
e2c2602
%{python_sitelib}/*
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
%files -n python3-%{srcname}
e2c2602
%doc LICENSE.txt
e2c2602
# For noarch packages: sitelib
e2c2602
%{python3_sitelib}/*
e2c2602
%endif # with_python3
e2c2602
e2c2602
%changelog
f54a32e
* Tue Jun 11 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-6
f54a32e
- Fix Requires of python-ordereddict to only apply to RHEL
f54a32e
750fa89
* Fri Mar  1 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-5
750fa89
- Unbundling finished!
750fa89
23a06f9
* Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4
23a06f9
- Upstream patch to fix Accept header when behind a proxy.
23a06f9
- Reorganize patch numbers to more clearly distinguish them.
23a06f9
e2c2602
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.5-3
e2c2602
- Renamed patches to python-urllib3-*
e2c2602
- Fixed ssl check patch to use the correct cert path for Fedora.
e2c2602
- Included dependency on ca-certificates
e2c2602
- Cosmetic indentation changes to the .spec file.
e2c2602
e2c2602
* Tue Feb  5 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-2
e2c2602
- python3-tornado BR and run all unittests on python3
e2c2602
e2c2602
* Mon Feb 04 2013 Toshio Kuratomi <toshio@fedoraproject.org> 1.5-1
e2c2602
- Initial fedora build.
e2c2602