af5280
%if 0%{?rhel} && 0%{?rhel} <= 6
af5280
%{!?__python2:        %global __python2 /usr/bin/python2}
af5280
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
af5280
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
af5280
%endif
af5280
e2c260
%global with_python3 1
059737
059737
%if 0%{?fedora}
059737
%{!?python3_pkgversion: %global python3_pkgversion 3}
059737
%else
059737
%{!?python3_pkgversion: %global python3_pkgversion 34}
e2c260
%endif
e2c260
e2c260
%global srcname urllib3
e2c260
e2c260
Name:           python-%{srcname}
059737
Version:        1.15.1
bc8615
Release:        3%{?dist}
e2c260
Summary:        Python HTTP library with thread-safe connection pooling and file post
e2c260
e2c260
License:        MIT
e2c260
URL:            http://urllib3.readthedocs.org/
059737
Source0:        https://pypi.io/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
762324
762324
# Only used for python3 (and for python2 on F22 and newer)
a641ca
Source1:        ssl_match_hostname_py3.py
762324
762324
# Only used for F21.
a1d2b3
Patch0:         python-urllib3-pyopenssl.patch
23a06f
e2c260
# Remove logging-clear-handlers from setup.cfg because it's not available in RHEL6's nose
e2c260
Patch100:       python-urllib3-old-nose-compat.patch
e2c260
e2c260
BuildArch:      noarch
e2c260
bc8615
%description
bc8615
Python HTTP module with connection pooling and file POST abilities.
bc8615
bc8615
%package -n python2-%{srcname}
bc8615
Summary:        Python2 HTTP library with thread-safe connection pooling and file post
bc8615
%{?python_provide:%python_provide python2-%{srcname}}
bc8615
e2c260
Requires:       ca-certificates
e2c260
f611c7
# Previously bundled things:
f611c7
Requires:       python-six
059737
Requires:       python-pysocks
059737
e2c260
BuildRequires:  python2-devel
e2c260
# For unittests
e2c260
BuildRequires:  python-nose
4a646b
BuildRequires:  python-mock
e2c260
BuildRequires:  python-six
059737
BuildRequires:  python-pysocks
f611c7
BuildRequires:  python-tornado
e2c260
bc8615
%if 0%{?rhel} && 0%{?rhel} <= 6
bc8615
BuildRequires:  python-ordereddict
bc8615
Requires:       python-ordereddict
bc8615
%endif
bc8615
bc8615
%description -n python2-%{srcname}
bc8615
Python2 HTTP module with connection pooling and file POST abilities.
bc8615
e2c260
%if 0%{?with_python3}
bc8615
%package -n python%{python3_pkgversion}-%{srcname}
bc8615
Summary:        Python3 HTTP library with thread-safe connection pooling and file post
bc8615
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
bc8615
059737
BuildRequires:  python%{python3_pkgversion}-devel
e2c260
# For unittests
059737
BuildRequires:  python%{python3_pkgversion}-nose
059737
BuildRequires:  python%{python3_pkgversion}-mock
059737
BuildRequires:  python%{python3_pkgversion}-six
059737
BuildRequires:  python%{python3_pkgversion}-pysocks
059737
BuildRequires:  python%{python3_pkgversion}-tornado
059737
059737
Requires:       ca-certificates
059737
Requires:       python%{python3_pkgversion}-six
059737
Requires:       python%{python3_pkgversion}-pysocks
059737
059737
%description -n python%{python3_pkgversion}-%{srcname}
e2c260
Python3 HTTP module with connection pooling and file POST abilities.
e2c260
%endif # with_python3
e2c260
e2c260
e2c260
%prep
a8898e
%setup -q -n %{srcname}-%{version}
e2c260
b73a1a
# Drop the dummyserver tests in koji.  They fail there in real builds, but not
b73a1a
# in scratch builds (weird).
b73a1a
rm -rf test/with_dummyserver/
b73a1a
e2c260
%if 0%{?rhel} && 0%{?rhel} <= 6
e2c260
%patch100 -p1
e2c260
%endif
e2c260
e2c260
%if 0%{?with_python3}
e2c260
rm -rf %{py3dir}
e2c260
cp -a . %{py3dir}
e2c260
%endif # with_python3
e2c260
a1d2b3
%if 0%{?fedora} == 21
a1d2b3
%patch0 -p1
a1d2b3
%endif
a1d2b3
e2c260
%build
f611c7
%{__python2} setup.py build
e2c260
e2c260
%if 0%{?with_python3}
e2c260
pushd %{py3dir}
e2c260
%{__python3} setup.py build
e2c260
popd
e2c260
%endif # with_python3
e2c260
e2c260
%install
e2c260
rm -rf %{buildroot}
f611c7
%{__python2} setup.py install --skip-build --root %{buildroot}
f611c7
f611c7
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py*
f611c7
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname/
f611c7
f611c7
mkdir -p %{buildroot}/%{python2_sitelib}/urllib3/packages/
f611c7
ln -s ../../six.py %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py
7e1581
ln -s ../../six.pyc %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyc
7e1581
ln -s ../../six.pyo %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyo
762324
762324
# In Fedora 22 and later, we ship Python 2.7.9 which carries an ssl module that
762324
# does what we need, so we replace urllib3's bundled ssl_match_hostname module
762324
# with our own that just proxies to the stdlib ssl module (to avoid carrying an
762324
# unnecessary dep on the backports.ssl_match_hostname module).
762324
# In Fedora 21 and earlier, we have an older Python 2.7, and so we require and
762324
# symlink in that backports.ssl_match_hostname module.
762324
#   https://bugzilla.redhat.com/show_bug.cgi?id=1231381
762324
%if 0%{?fedora} >= 22
afd6a7
cp %{SOURCE1} %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname.py
762324
%else
f611c7
ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname
762324
%endif
f611c7
f611c7
# Copy in six.py just for the test suite.
c79ce1
%if 0%{?fedora} >= 22
c79ce1
cp %{python2_sitelib}/six.* %{buildroot}/%{python2_sitelib}/.
c79ce1
%else
f611c7
cp %{python2_sitelib}/six.* %{buildroot}/%{python2_sitelib}/.
f611c7
cp -r %{python2_sitelib}/backports %{buildroot}/%{python2_sitelib}/.
c79ce1
%endif
e2c260
e2c260
# dummyserver is part of the unittest framework
f611c7
rm -rf %{buildroot}%{python2_sitelib}/dummyserver
e2c260
e2c260
%if 0%{?with_python3}
e2c260
pushd %{py3dir}
e2c260
%{__python3} setup.py install --skip-build --root %{buildroot}
e2c260
f611c7
rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py*
f611c7
rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname/
f611c7
f611c7
mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/
f611c7
ln -s ../../six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py
a641ca
cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py
f611c7
f611c7
# Copy in six.py just for the test suite.
f611c7
cp %{python3_sitelib}/six.* %{buildroot}/%{python3_sitelib}/.
f611c7
e2c260
# dummyserver is part of the unittest framework
e2c260
rm -rf %{buildroot}%{python3_sitelib}/dummyserver
e2c260
popd
e2c260
%endif # with_python3
e2c260
e2c260
%check
e2c260
nosetests
e2c260
f611c7
# And after its done, remove our copied in bits
f611c7
rm -rf %{buildroot}/%{python2_sitelib}/six*
f611c7
rm -rf %{buildroot}/%{python2_sitelib}/backports*
f611c7
e2c260
%if 0%{?with_python3}
e2c260
pushd %{py3dir}
e2c260
nosetests-%{python3_version}
e2c260
popd
f611c7
f611c7
# And after its done, remove our copied in bits
f611c7
rm -rf %{buildroot}/%{python3_sitelib}/six*
f611c7
rm -rf %{buildroot}/%{python3_sitelib}/__pycache__*
e2c260
%endif # with_python3
e2c260
bc8615
%files -n python2-%{srcname}
149e0e
%{!?_licensedir:%global license %%doc}
149e0e
%license LICENSE.txt
149e0e
%doc CHANGES.rst README.rst CONTRIBUTORS.txt
e2c260
# For noarch packages: sitelib
f611c7
%{python2_sitelib}/urllib3/
f611c7
%{python2_sitelib}/urllib3-*.egg-info
e2c260
e2c260
%if 0%{?with_python3}
059737
%files -n python%{python3_pkgversion}-%{srcname}
149e0e
%{!?_licensedir:%global license %%doc}
149e0e
%license LICENSE.txt
e2c260
# For noarch packages: sitelib
f611c7
%{python3_sitelib}/urllib3/
f611c7
%{python3_sitelib}/urllib3-*.egg-info
e2c260
%endif # with_python3
e2c260
e2c260
%changelog
bc8615
* Thu Jun 02 2016 Ralph Bean <rbean@redhat.com> - 1.15.1-3
bc8615
- Create python2 subpackage to comply with guidelines.
bc8615
646b32
* Wed Jun 01 2016 Ralph Bean <rbean@redhat.com> - 1.15.1-2
646b32
- Remove broken symlinks to unbundled python3-six files
646b32
  https://bugzilla.redhat.com/show_bug.cgi?id=1295015
646b32
059737
* Fri Apr 29 2016 Ralph Bean <rbean@redhat.com> - 1.15.1-1
059737
- Removed patch for ipv6 support, now applied upstream.
059737
- Latest version.
059737
- New dep on pysocks.
059737
baa577
* Fri Feb 26 2016 Ralph Bean <rbean@redhat.com> - 1.13.1-3
baa577
- Apply patch from upstream to fix ipv6.
baa577
84fceb
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.13.1-2
84fceb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
84fceb
948bea
* Mon Dec 21 2015 Ralph Bean <rbean@redhat.com> - 1.13.1-1
948bea
- new version
948bea
298ec5
* Fri Dec 18 2015 Ralph Bean <rbean@redhat.com> - 1.13-1
298ec5
- new version
298ec5
5e3e64
* Mon Dec 14 2015 Ralph Bean <rbean@redhat.com> - 1.12-1
5e3e64
- new version
5e3e64
Robert Kuska 9cbc25
* Thu Oct 15 2015 Robert Kuska <rkuska@redhat.com> - 1.10.4-7
Robert Kuska 9cbc25
- Rebuilt for Python3.5 rebuild
Robert Kuska 9cbc25
a8898e
* Sat Oct 10 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-6
a8898e
- Sync from PyPI instead of a git checkout.
a8898e
762324
* Tue Sep 08 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-5.20150503gita91975b
762324
- Drop requirement on python-backports-ssl_match_hostname on F22 and newer.
762324
d15a22
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10.4-4.20150503gita91975b
d15a22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
d15a22
a1d2b3
* Mon Jun 08 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-3.20150503gita91975b
a1d2b3
- Apply pyopenssl injection for an outdated cpython as per upstream advice
a1d2b3
  https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
a1d2b3
  https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl
a1d2b3
7e1581
* Tue May 19 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-2.20150503gita91975b
7e1581
- Specify symlinks for six.py{c,o}, fixing rhbz #1222142.
7e1581
7e1581
* Sun May 03 2015 Ralph Bean <rbean@redhat.com> - 1.10.4-1.20150503gita91975b
65b036
- Latest release for python-requests-2.7.0
65b036
98fa60
* Wed Apr 29 2015 Ralph Bean <rbean@redhat.com> - 1.10.3-2.20150429git585983a
98fa60
- Grab a git snapshot to get around this chunked encoding failure.
817aac
9dff84
* Wed Apr 22 2015 Ralph Bean <rbean@redhat.com> - 1.10.3-1
9dff84
- new version
9dff84
db79cb
* Thu Feb 26 2015 Ralph Bean <rbean@redhat.com> - 1.10.2-1
db79cb
- new version
db79cb
5ce430
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 1.10.1-1
5ce430
- new version
5ce430
39487a
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 1.10.1-1
39487a
- new version
39487a
a641ca
* Mon Jan 05 2015 Ralph Bean <rbean@redhat.com> - 1.10-2
a641ca
- Copy in a shim for ssl_match_hostname on python3.
a641ca
f611c7
* Sun Dec 14 2014 Ralph Bean <rbean@redhat.com> - 1.10-1
f611c7
- Latest upstream 1.10, for python-requests-2.5.0.
f611c7
- Re-do unbundling without patch, with symlinks.
f611c7
- Modernize python2 macros.
2d1020
- Remove the with_dummyserver tests which fail only sometimes.
f611c7
196058
* Wed Nov 05 2014 Ralph Bean <rbean@redhat.com> - 1.9.1-1
196058
- Latest upstream, 1.9.1 for latest python-requests.
196058
149e0e
* Mon Aug  4 2014 Tom Callaway <spot@fedoraproject.org> - 1.8.2-4
149e0e
- fix license handling
149e0e
90da22
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.2-3
90da22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
90da22
b8e7d5
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.8.2-2
b8e7d5
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
b8e7d5
131a80
* Mon Apr 21 2014 Arun S A G <sagarun@gmail.com> - 1.8.2-1
131a80
- Update to latest upstream version
131a80
467067
* Mon Oct 28 2013 Ralph Bean <rbean@redhat.com> - 1.7.1-2
467067
- Update patch to find ca_certs in the correct location.
467067
4a646b
* Wed Sep 25 2013 Ralph Bean <rbean@redhat.com> - 1.7.1-1
4a646b
- Latest upstream with support for a new timeout class and py3.4.
4a646b
89b180
* Wed Aug 28 2013 Ralph Bean <rbean@redhat.com> - 1.7-3
89b180
- Bump release again, just to push an unpaired update.
89b180
e709c8
* Mon Aug 26 2013 Ralph Bean <rbean@redhat.com> - 1.7-2
e709c8
- Bump release to pair an update with python-requests.
e709c8
1563f3
* Thu Aug 22 2013 Ralph Bean <rbean@redhat.com> - 1.7-1
1563f3
- Update to latest upstream.
1563f3
- Removed the accept-header proxy patch which is included in upstream now.
1563f3
- Removed py2.6 compat patch which is included in upstream now.
1563f3
da55d7
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5-7
da55d7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
da55d7
f54a32
* Tue Jun 11 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-6
f54a32
- Fix Requires of python-ordereddict to only apply to RHEL
f54a32
750fa8
* Fri Mar  1 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-5
750fa8
- Unbundling finished!
750fa8
23a06f
* Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4
23a06f
- Upstream patch to fix Accept header when behind a proxy.
23a06f
- Reorganize patch numbers to more clearly distinguish them.
23a06f
e2c260
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.5-3
e2c260
- Renamed patches to python-urllib3-*
e2c260
- Fixed ssl check patch to use the correct cert path for Fedora.
e2c260
- Included dependency on ca-certificates
e2c260
- Cosmetic indentation changes to the .spec file.
e2c260
e2c260
* Tue Feb  5 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-2
e2c260
- python3-tornado BR and run all unittests on python3
e2c260
e2c260
* Mon Feb 04 2013 Toshio Kuratomi <toshio@fedoraproject.org> 1.5-1
e2c260
- Initial fedora build.