b18fa3
# Tests need an internet connection, so they are disabled by default
b18fa3
%bcond_with online_tests
b18fa3
dbd2ef
%if 0%{?fedora}
dbd2ef
%global _with_python3 1
dbd2ef
%else
dbd2ef
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
dbd2ef
%endif
dbd2ef
dbd2ef
Name:           python-requests
dbd2ef
Version:        2.6.0
b18fa3
Release:        10%{?dist}
dbd2ef
Summary:        HTTP library, written in Python, for human beings
dbd2ef
dbd2ef
License:        ASL 2.0
dbd2ef
URL:            http://pypi.python.org/pypi/requests
dbd2ef
Source0:        http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz
dbd2ef
# Explicitly use the system certificates in ca-certificates.
dbd2ef
# https://bugzilla.redhat.com/show_bug.cgi?id=904614
dbd2ef
Patch0:         python-requests-system-cert-bundle.patch
dbd2ef
dbd2ef
# Remove an unnecessary reference to a bundled compat lib in urllib3
dbd2ef
Patch1:         python-requests-remove-nested-bundling-dep.patch
dbd2ef
b18fa3
# Modify tests to run in pytest so that we can run backported parametrized
b18fa3
# tests (Patch4: fix-default-port-handling.patch).
b18fa3
# We cannot launch the tests during build as they require internet, but QE
b18fa3
# launches them later.
b18fa3
# Minimal version of this upstream change:
b18fa3
#   https://github.com/psf/requests/commit/6c2942b19865106a3ac65b3bfc1fc93aae2d346c
b18fa3
Patch2:         modify-tests-to-run-in-pytest.patch
b18fa3
dbd2ef
# Fix for CVE-2018-18074
dbd2ef
# Resolved upstream: https://github.com/requests/requests/pull/4718
b18fa3
Patch3:         fix-CVE-2018-18074.patch
dbd2ef
dbd2ef
# Fix handling of default ports in auth stripping
dbd2ef
# Resolved upstream: https://github.com/psf/requests/pull/4851
b18fa3
Patch4:         fix-default-port-handling.patch
b18fa3
b18fa3
# Fix a leaking test that was making another test (test_auth_is_stripped_on_redirect_off_host) fail
b18fa3
# Resolved upstream: https://github.com/psf/requests/commit/9b63f9cd37d19f2d4bbce42caec112ad0606d8dd
b18fa3
Patch5:         fix-leaking-test.patch
b18fa3
b18fa3
# The upstream requests library bundles urllib3 and chardet, and then
b18fa3
# manipulates the module namespace in order to alias the packages to
b18fa3
# the system ones if a distribution unbundles them. This however can lead
b18fa3
# to side effects, such as creating different instances of the modules
b18fa3
# in memory where changes can happen to a module but not reflected to another,
b18fa3
# leading to undefined behavior.
b18fa3
# This patch changes all the import statements for urllib3 and chardet to import
b18fa3
# from the global namespace, thus avoiding the instance duplication.
b18fa3
# Partial backport from https://github.com/psf/requests/pull/4067
b18fa3
# Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1750839
b18fa3
Patch6: import-urllib3-and-chardet-from-the-global-namespace.patch
b18fa3
b18fa3
# While the requests.packages aliasing has been removed since
b18fa3
# it caused various issues while it's also an undocumented API,
b18fa3
# much code in the wild still relies on it. This fix ensures
b18fa3
# that while the naming scheme is there for backwards compatibility,
b18fa3
# the submodules contained in the requests.packages namespace
b18fa3
# are properly aliased to the system installed modules.
b18fa3
# Inspired by https://github.com/psf/requests/blob/v2.18.0/requests/packages.py
b18fa3
# Resolves: rhbz#1785607, rhbz#1785666, rhbz#1785696, rhbz#1787679
b18fa3
Patch7: fix-requests.packages-aliasing.patch
dbd2ef
dbd2ef
BuildArch:      noarch
dbd2ef
BuildRequires:  python2-devel
dbd2ef
BuildRequires:  python-chardet >= 2.2.1-1
dbd2ef
BuildRequires:  python-urllib3 >= 1.10.2-1
dbd2ef
b18fa3
%if %{with online_tests}
b18fa3
BuildRequires:  pytest
b18fa3
%endif
b18fa3
dbd2ef
Requires:       ca-certificates
dbd2ef
Requires:       python-chardet >= 2.2.1-1
dbd2ef
Requires:       python-urllib3 >= 1.10.2-1
dbd2ef
dbd2ef
%if 0%{?rhel} && 0%{?rhel} <= 6
dbd2ef
BuildRequires:  python-ordereddict >= 1.1
dbd2ef
Requires:       python-ordereddict >= 1.1
dbd2ef
%endif
dbd2ef
dbd2ef
Provides:       python2-requests = %{version}-%{release}
dbd2ef
Obsoletes:      python2-requests < %{version}-%{release}
dbd2ef
dbd2ef
%description
dbd2ef
Most existing Python modules for sending HTTP requests are extremely verbose and 
dbd2ef
cumbersome. Python’s built-in urllib2 module provides most of the HTTP 
dbd2ef
capabilities you should need, but the API is thoroughly broken. This library is 
dbd2ef
designed to make HTTP requests easy for developers.
dbd2ef
dbd2ef
%if 0%{?_with_python3}
dbd2ef
%package -n python3-requests
dbd2ef
Summary: HTTP library, written in Python, for human beings
dbd2ef
BuildRequires:  python3-devel
dbd2ef
BuildRequires:  python3-chardet
dbd2ef
BuildRequires:  python3-urllib3
b18fa3
%if %{with online_tests}
b18fa3
BuildRequires:  python3-pytest
b18fa3
%endif
dbd2ef
Requires:       python3-chardet
dbd2ef
Requires:       python3-urllib3
dbd2ef
dbd2ef
%description -n python3-requests
dbd2ef
Most existing Python modules for sending HTTP requests are extremely verbose and
dbd2ef
cumbersome. Python’s built-in urllib2 module provides most of the HTTP
dbd2ef
capabilities you should need, but the API is thoroughly broken. This library is
dbd2ef
designed to make HTTP requests easy for developers.
dbd2ef
%endif
dbd2ef
dbd2ef
%prep
dbd2ef
%setup -q -n requests-%{version}
dbd2ef
dbd2ef
%patch0 -p1
dbd2ef
%patch1 -p1
dbd2ef
%patch2 -p1
dbd2ef
%patch3 -p1
b18fa3
%patch4 -p1
b18fa3
%patch5 -p1
b18fa3
%patch6 -p1
b18fa3
%patch7 -p1
dbd2ef
dbd2ef
# Unbundle the certificate bundle from mozilla.
dbd2ef
rm -rf requests/cacert.pem
dbd2ef
dbd2ef
%if 0%{?_with_python3}
dbd2ef
rm -rf %{py3dir}
dbd2ef
cp -a . %{py3dir}
dbd2ef
%endif # with_python3
dbd2ef
dbd2ef
%build
dbd2ef
%if 0%{?_with_python3}
dbd2ef
pushd %{py3dir}
dbd2ef
%{__python3} setup.py build
dbd2ef
dbd2ef
# Unbundle chardet and urllib3.
dbd2ef
rm -rf build/lib/requests/packages/chardet
dbd2ef
rm -rf build/lib/requests/packages/urllib3
dbd2ef
dbd2ef
popd
dbd2ef
%endif
dbd2ef
dbd2ef
%py2_build
dbd2ef
dbd2ef
# Unbundle chardet and urllib3.
dbd2ef
rm -rf build/lib/requests/packages/chardet
dbd2ef
rm -rf build/lib/requests/packages/urllib3
dbd2ef
dbd2ef
%install
dbd2ef
rm -rf $RPM_BUILD_ROOT
dbd2ef
%if 0%{?_with_python3}
dbd2ef
pushd %{py3dir}
dbd2ef
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
dbd2ef
popd
dbd2ef
%endif
dbd2ef
dbd2ef
%py2_install
dbd2ef
b18fa3
%if %{with online_tests}
b18fa3
# The tests succeed if run locally, but fail in koji.
b18fa3
# They require an active network connection to query httpbin.org
b18fa3
%check
b18fa3
%{__python} -m pytest test_requests.py
b18fa3
%if 0%{?_with_python3}
b18fa3
pushd %{py3dir}
b18fa3
%{__python3} -m pytest test_requests.py
b18fa3
popd
b18fa3
%endif
b18fa3
%endif #with online_tests
dbd2ef
dbd2ef
%files
dbd2ef
%defattr(-,root,root,-)
dbd2ef
%doc NOTICE LICENSE README.rst HISTORY.rst
dbd2ef
%{python2_sitelib}/*.egg-info
dbd2ef
%dir %{python2_sitelib}/requests
dbd2ef
%{python2_sitelib}/requests/*
dbd2ef
dbd2ef
%if 0%{?_with_python3}
dbd2ef
%files -n python3-requests
dbd2ef
%{python3_sitelib}/*.egg-info
dbd2ef
%{python3_sitelib}/requests/
dbd2ef
%endif
dbd2ef
dbd2ef
%changelog
b18fa3
* Tue Mar 10 2020 Charalampos Stratakis <cstratak@redhat.com> - 2.6.0-10
b18fa3
- Fix test_urllib3_retries by having it import urllib3 from the global namespace
b18fa3
Resolves: rhbz#1771567
b18fa3
b18fa3
* Wed Feb 19 2020 Charalampos Stratakis <cstratak@redhat.com> - 2.6.0-9
b18fa3
- Bring back the requests.packages aliasing of its submodules
b18fa3
Resolves: rhbz#1785607, rhbz#1785666, rhbz#1785696, rhbz#1787679
b18fa3
b18fa3
* Thu Oct 24 2019 Charalampos Stratakis <cstratak@redhat.com> - 2.6.0-8
b18fa3
- Import urllib3 and chardet from the global namespace
b18fa3
Resolves: rhbz#1750839
b18fa3
b18fa3
* Thu Oct 03 2019 Tomas Orsava <torsava@redhat.com> - 2.6.0-7
b18fa3
- Modify tests to run in pytest
b18fa3
- Add a bcond online_tests to enable the tests
b18fa3
Related: rhbz#1745417
b18fa3
dbd2ef
* Tue Aug 27 2019 Charalampos Stratakis <cstratak@redhat.com> - 2.6.0-6
dbd2ef
- Fix handling of default ports in auth stripping
dbd2ef
Resolves: rhbz#1745417
dbd2ef
dbd2ef
* Mon Nov 26 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.6.0-5
dbd2ef
- Fix CVE-2018-18074
dbd2ef
Resolves: rhbz#1647368
dbd2ef
dbd2ef
* Wed Jun 03 2015 Matej Stuchlik <mstuchli@redhat.com> - 2.6.0-1
dbd2ef
- Update to 2.6.0
dbd2ef
Resolves: rhbz#1214365
dbd2ef
dbd2ef
* Mon Jan 12 2015 Endi S. Dewata <edewata@redhat.com> - 1.1.0-9
dbd2ef
- Merged headers with different cases.
dbd2ef
dbd2ef
* Mon Jan 27 2014 Endi S. Dewata <edewata@redhat.com> - 1.1.0-8
dbd2ef
- Removed authentication header on redirect.
dbd2ef
dbd2ef
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.1.0-7
dbd2ef
- Mass rebuild 2013-12-27
dbd2ef
dbd2ef
* Fri Oct  4 2013 Endi S. Dewata <edewata@redhat.com> - 1.1.0-6
dbd2ef
- Removed bundled packages.
dbd2ef
dbd2ef
* Tue Jun 18 2013 Endi S. Dewata <edewata@redhat.com> - 1.1.0-5
dbd2ef
- Fixed bogus date in changelog entry.
dbd2ef
dbd2ef
* Tue Jun 11 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-4
dbd2ef
- Correct a rhel conditional on python-ordereddict
dbd2ef
dbd2ef
* Thu Feb 28 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-3
dbd2ef
- Unbundled python-urllib3.  Using system python-urllib3 now.
dbd2ef
- Conditionally include python-ordereddict for el6.
dbd2ef
dbd2ef
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-2
dbd2ef
- Unbundled python-charade/chardet.  Using system python-chardet now.
dbd2ef
- Removed deprecated comments and actions against oauthlib unbundling.
dbd2ef
  Those are no longer necessary in 1.1.0.
dbd2ef
- Added links to bz tickets over Patch declarations.
dbd2ef
dbd2ef
* Tue Feb 26 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-1
dbd2ef
- Latest upstream.
dbd2ef
- Relicense to ASL 2.0 with upstream.
dbd2ef
- Removed cookie handling patch (fixed in upstream tarball).
dbd2ef
- Updated cert unbundling patch to match upstream.
dbd2ef
- Added check section, but left it commented out for koji.
dbd2ef
dbd2ef
* Fri Feb  8 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.14.1-4
dbd2ef
- Let brp_python_bytecompile run again, take care of the non-python{2,3} modules
dbd2ef
  by removing them from the python{,3}-requests package that they did not belong
dbd2ef
  in.
dbd2ef
- Use the certificates in the ca-certificates package instead of the bundled one
dbd2ef
  + https://bugzilla.redhat.com/show_bug.cgi?id=904614
dbd2ef
- Fix a problem with cookie handling
dbd2ef
  + https://bugzilla.redhat.com/show_bug.cgi?id=906924
dbd2ef
dbd2ef
* Mon Oct 22 2012 Arun S A G <sagarun@gmail.com>  0.14.1-1
dbd2ef
- Updated to latest upstream release
dbd2ef
dbd2ef
* Sun Jun 10 2012 Arun S A G <sagarun@gmail.com> 0.13.1-1
dbd2ef
- Updated to latest upstream release 0.13.1
dbd2ef
- Use system provided ca-certificates
dbd2ef
- No more async requests use grrequests https://github.com/kennethreitz/grequests
dbd2ef
- Remove gevent as it is no longer required by requests
dbd2ef
dbd2ef
* Sun Apr 01 2012 Arun S A G <sagarun@gmail.com> 0.11.1-1
dbd2ef
- Updated to upstream release 0.11.1
dbd2ef
dbd2ef
* Thu Mar 29 2012 Arun S A G <sagarun@gmail.com> 0.10.6-3
dbd2ef
- Support building package for EL6
dbd2ef
dbd2ef
* Tue Mar 27 2012 Rex Dieter <rdieter@fedoraproject.org> 0.10.6-2
dbd2ef
- +python3-requests pkg
dbd2ef
dbd2ef
* Sat Mar 3 2012 Arun SAG <sagarun@gmail.com> - 0.10.6-1
dbd2ef
- Updated to new upstream version
dbd2ef
dbd2ef
* Sat Jan 21 2012 Arun SAG <sagarun@gmail.com> - 0.9.3-1
dbd2ef
- Updated to new upstream version 0.9.3
dbd2ef
- Include python-gevent as a dependency for requests.async
dbd2ef
- Clean up shebangs in requests/setup.py,test_requests.py and test_requests_ext.py
dbd2ef
dbd2ef
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2-2
dbd2ef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
dbd2ef
dbd2ef
* Sun Nov 27 2011 Arun SAG <sagarun@gmail.com> - 0.8.2-1
dbd2ef
- New upstream version
dbd2ef
- keep alive support
dbd2ef
- complete removal of cookiejar and urllib2
dbd2ef
dbd2ef
* Thu Nov 10 2011 Arun SAG <sagarun@gmail.com> - 0.7.6-1
dbd2ef
- Updated to new upstream release 0.7.6
dbd2ef
dbd2ef
* Thu Oct 20 2011 Arun SAG <sagarun@gmail.com> - 0.6.6-1
dbd2ef
- Updated to version 0.6.6
dbd2ef
dbd2ef
* Fri Aug 26 2011 Arun SAG <sagarun@gmail.com> - 0.6.1-1
dbd2ef
- Updated to version 0.6.1
dbd2ef
dbd2ef
* Sat Aug 20 2011 Arun SAG <sagarun@gmail.com> - 0.6.0-1
dbd2ef
- Updated to latest version 0.6.0
dbd2ef
dbd2ef
* Mon Aug 15 2011 Arun SAG <sagarun@gmail.com> - 0.5.1-2
dbd2ef
- Remove OPT_FLAGS from build section since it is a noarch package
dbd2ef
- Fix use of mixed tabs and space
dbd2ef
- Remove extra space around the word cumbersome in description
dbd2ef
dbd2ef
* Sun Aug 14 2011 Arun SAG <sagarun@gmail.com> - 0.5.1-1
dbd2ef
- Initial package