af5280c
%if 0%{?rhel} && 0%{?rhel} <= 6
af5280c
%{!?__python2:        %global __python2 /usr/bin/python2}
af5280c
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
af5280c
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
af5280c
%endif
af5280c
e2c2602
%if 0%{?fedora}
e2c2602
%global with_python3 1
e2c2602
%endif
e2c2602
e2c2602
%global srcname urllib3
e2c2602
e2c2602
Name:           python-%{srcname}
5e3e64d
Version:        1.12
5e3e64d
Release:        1%{?dist}
e2c2602
Summary:        Python HTTP library with thread-safe connection pooling and file post
e2c2602
e2c2602
License:        MIT
e2c2602
URL:            http://urllib3.readthedocs.org/
a8898e4
Source0:        https://pypi.python.org/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
762324a
762324a
# Only used for python3 (and for python2 on F22 and newer)
a641ca8
Source1:        ssl_match_hostname_py3.py
762324a
762324a
# Only used for F21.
a1d2b32
Patch0:         python-urllib3-pyopenssl.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
e2c2602
e2c2602
BuildArch:      noarch
e2c2602
e2c2602
Requires:       ca-certificates
e2c2602
f611c7a
# Previously bundled things:
f611c7a
Requires:       python-six
762324a
762324a
# See comment-block in the %%install section.
762324a
# https://bugzilla.redhat.com/show_bug.cgi?id=1231381
762324a
%if 0%{?fedora} && 0%{?fedora} <= 21
1960586
Requires:       python-backports-ssl_match_hostname
762324a
BuildRequires:  python-backports-ssl_match_hostname
762324a
%endif
f611c7a
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
4a646b9
BuildRequires:  python-mock
e2c2602
BuildRequires:  python-six
f611c7a
BuildRequires:  python-tornado
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
BuildRequires:  python3-devel
e2c2602
# For unittests
e2c2602
BuildRequires:  python3-nose
4a646b9
BuildRequires:  python3-mock
e2c2602
BuildRequires:  python3-six
e2c2602
BuildRequires:  python3-tornado
e2c2602
%endif # with_python3
e2c2602
a1d2b32
a1d2b32
%if 0%{?fedora} == 21
a1d2b32
BuildRequires:  pyOpenSSL
a1d2b32
BuildRequires:  python-ndg_httpsclient
a1d2b32
BuildRequires:  python-pyasn1
a1d2b32
Requires:       pyOpenSSL
a1d2b32
Requires:       python-ndg_httpsclient
a1d2b32
Requires:       python-pyasn1
a1d2b32
%endif
a1d2b32
a1d2b32
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
a8898e4
%setup -q -n %{srcname}-%{version}
e2c2602
2d10204
# Drop the dummyserver tests in koji.  They fail there in real builds, but not
2d10204
# in scratch builds (weird).
2d10204
rm -rf test/with_dummyserver/
2d10204
e2c2602
%if 0%{?rhel} && 0%{?rhel} <= 6
e2c2602
%patch100 -p1
e2c2602
%endif
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
rm -rf %{py3dir}
e2c2602
cp -a . %{py3dir}
e2c2602
%endif # with_python3
e2c2602
a1d2b32
%if 0%{?fedora} == 21
a1d2b32
%patch0 -p1
a1d2b32
%endif
a1d2b32
e2c2602
%build
f611c7a
%{__python2} 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}
f611c7a
%{__python2} setup.py install --skip-build --root %{buildroot}
f611c7a
f611c7a
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py*
f611c7a
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname/
f611c7a
f611c7a
mkdir -p %{buildroot}/%{python2_sitelib}/urllib3/packages/
f611c7a
ln -s ../../six.py %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py
7e15819
ln -s ../../six.pyc %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyc
7e15819
ln -s ../../six.pyo %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyo
762324a
762324a
# In Fedora 22 and later, we ship Python 2.7.9 which carries an ssl module that
762324a
# does what we need, so we replace urllib3's bundled ssl_match_hostname module
762324a
# with our own that just proxies to the stdlib ssl module (to avoid carrying an
762324a
# unnecessary dep on the backports.ssl_match_hostname module).
762324a
# In Fedora 21 and earlier, we have an older Python 2.7, and so we require and
762324a
# symlink in that backports.ssl_match_hostname module.
762324a
#   https://bugzilla.redhat.com/show_bug.cgi?id=1231381
762324a
%if 0%{?fedora} >= 22
afd6a78
cp %{SOURCE1} %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname.py
762324a
%else
f611c7a
ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname
762324a
%endif
f611c7a
f611c7a
# Copy in six.py just for the test suite.
c79ce17
%if 0%{?fedora} >= 22
c79ce17
cp %{python2_sitelib}/six.* %{buildroot}/%{python2_sitelib}/.
c79ce17
%else
f611c7a
cp %{python2_sitelib}/six.* %{buildroot}/%{python2_sitelib}/.
f611c7a
cp -r %{python2_sitelib}/backports %{buildroot}/%{python2_sitelib}/.
c79ce17
%endif
e2c2602
e2c2602
# dummyserver is part of the unittest framework
f611c7a
rm -rf %{buildroot}%{python2_sitelib}/dummyserver
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
pushd %{py3dir}
e2c2602
%{__python3} setup.py install --skip-build --root %{buildroot}
e2c2602
f611c7a
rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py*
f611c7a
rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname/
f611c7a
f611c7a
mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/
f611c7a
ln -s ../../six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py
7e15819
ln -s ../../six.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/six.pyc
7e15819
ln -s ../../six.pyo %{buildroot}/%{python3_sitelib}/urllib3/packages/six.pyo
a641ca8
cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py
f611c7a
f611c7a
# Copy in six.py just for the test suite.
f611c7a
cp %{python3_sitelib}/six.* %{buildroot}/%{python3_sitelib}/.
f611c7a
e2c2602
# dummyserver is part of the unittest framework
e2c2602
rm -rf %{buildroot}%{python3_sitelib}/dummyserver
e2c2602
popd
e2c2602
%endif # with_python3
e2c2602
e2c2602
%check
a1d2b32
%if 0%{?fedora} == 21
a1d2b32
# On Fedora 21, we inject pyopenssl which works, but makes some tests fail, so
a1d2b32
# skip them.
a1d2b32
# https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
a1d2b32
# https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl
a1d2b32
%else
e2c2602
nosetests
a1d2b32
%endif
e2c2602
f611c7a
# And after its done, remove our copied in bits
f611c7a
rm -rf %{buildroot}/%{python2_sitelib}/six*
f611c7a
rm -rf %{buildroot}/%{python2_sitelib}/backports*
f611c7a
e2c2602
%if 0%{?with_python3}
e2c2602
pushd %{py3dir}
e2c2602
nosetests-%{python3_version}
e2c2602
popd
f611c7a
f611c7a
# And after its done, remove our copied in bits
f611c7a
rm -rf %{buildroot}/%{python3_sitelib}/six*
f611c7a
rm -rf %{buildroot}/%{python3_sitelib}/__pycache__*
e2c2602
%endif # with_python3
e2c2602
e2c2602
%files
149e0ed
%{!?_licensedir:%global license %%doc}
149e0ed
%license LICENSE.txt
149e0ed
%doc CHANGES.rst README.rst CONTRIBUTORS.txt
e2c2602
# For noarch packages: sitelib
f611c7a
%{python2_sitelib}/urllib3/
f611c7a
%{python2_sitelib}/urllib3-*.egg-info
e2c2602
e2c2602
%if 0%{?with_python3}
e2c2602
%files -n python3-%{srcname}
149e0ed
%{!?_licensedir:%global license %%doc}
149e0ed
%license LICENSE.txt
e2c2602
# For noarch packages: sitelib
f611c7a
%{python3_sitelib}/urllib3/
f611c7a
%{python3_sitelib}/urllib3-*.egg-info
e2c2602
%endif # with_python3
e2c2602
e2c2602
%changelog
5e3e64d
* Mon Dec 14 2015 Ralph Bean <rbean@redhat.com> - 1.12-1
5e3e64d
- new version
5e3e64d
Robert Kuska 9cbc253
* Thu Oct 15 2015 Robert Kuska <rkuska@redhat.com> - 1.10.4-7
Robert Kuska 9cbc253
- Rebuilt for Python3.5 rebuild
Robert Kuska 9cbc253
a8898e4
* Sat Oct 10 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-6
a8898e4
- Sync from PyPI instead of a git checkout.
a8898e4
762324a
* Tue Sep 08 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-5.20150503gita91975b
762324a
- Drop requirement on python-backports-ssl_match_hostname on F22 and newer.
762324a
d15a22c
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10.4-4.20150503gita91975b
d15a22c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
d15a22c
a1d2b32
* Mon Jun 08 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-3.20150503gita91975b
a1d2b32
- Apply pyopenssl injection for an outdated cpython as per upstream advice
a1d2b32
  https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
a1d2b32
  https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl
a1d2b32
7e15819
* Tue May 19 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-2.20150503gita91975b
7e15819
- Specify symlinks for six.py{c,o}, fixing rhbz #1222142.
7e15819
7e15819
* Sun May 03 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-1.20150503gita91975b
65b0367
- Latest release for python-requests-2.7.0
65b0367
98fa605
* Wed Apr 29 2015 Ralph Bean <rbean@redhat.com> - 1.10.3-2.20150429git585983a
98fa605
- Grab a git snapshot to get around this chunked encoding failure.
817aac8
9dff84a
* Wed Apr 22 2015 Ralph Bean <rbean@redhat.com> - 1.10.3-1
9dff84a
- new version
9dff84a
db79cba
* Thu Feb 26 2015 Ralph Bean <rbean@redhat.com> - 1.10.2-1
db79cba
- new version
db79cba
5ce4305
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 1.10.1-1
5ce4305
- new version
5ce4305
39487aa
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 1.10.1-1
39487aa
- new version
39487aa
a641ca8
* Mon Jan 05 2015 Ralph Bean <rbean@redhat.com> - 1.10-2
a641ca8
- Copy in a shim for ssl_match_hostname on python3.
a641ca8
f611c7a
* Sun Dec 14 2014 Ralph Bean <rbean@redhat.com> - 1.10-1
f611c7a
- Latest upstream 1.10, for python-requests-2.5.0.
f611c7a
- Re-do unbundling without patch, with symlinks.
f611c7a
- Modernize python2 macros.
2d10204
- Remove the with_dummyserver tests which fail only sometimes.
f611c7a
1960586
* Wed Nov 05 2014 Ralph Bean <rbean@redhat.com> - 1.9.1-1
1960586
- Latest upstream, 1.9.1 for latest python-requests.
1960586
149e0ed
* Mon Aug  4 2014 Tom Callaway <spot@fedoraproject.org> - 1.8.2-4
149e0ed
- fix license handling
149e0ed
90da227
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.2-3
90da227
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
90da227
b8e7d56
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.8.2-2
b8e7d56
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
b8e7d56
131a805
* Mon Apr 21 2014 Arun S A G <sagarun@gmail.com> - 1.8.2-1
131a805
- Update to latest upstream version
131a805
4670672
* Mon Oct 28 2013 Ralph Bean <rbean@redhat.com> - 1.7.1-2
4670672
- Update patch to find ca_certs in the correct location.
4670672
4a646b9
* Wed Sep 25 2013 Ralph Bean <rbean@redhat.com> - 1.7.1-1
4a646b9
- Latest upstream with support for a new timeout class and py3.4.
4a646b9
89b1807
* Wed Aug 28 2013 Ralph Bean <rbean@redhat.com> - 1.7-3
89b1807
- Bump release again, just to push an unpaired update.
89b1807
e709c88
* Mon Aug 26 2013 Ralph Bean <rbean@redhat.com> - 1.7-2
e709c88
- Bump release to pair an update with python-requests.
e709c88
1563f31
* Thu Aug 22 2013 Ralph Bean <rbean@redhat.com> - 1.7-1
1563f31
- Update to latest upstream.
1563f31
- Removed the accept-header proxy patch which is included in upstream now.
1563f31
- Removed py2.6 compat patch which is included in upstream now.
1563f31
da55d72
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5-7
da55d72
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
da55d72
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.