Fedora contributions by:
Adam Kolar <akolar@redhat.com>
Adam Williamson <awilliam@redhat.com>
Arun SAG <sagarun@gmail.com>
Benjamin A. Beasley <code@musicinmybrain.net>
Charalampos Stratakis <cstratak@redhat.com>
David Malcolm <dmalcolm@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Iryna Shcherbina <shcherbina.iryna@gmail.com>
Jeremy Cline <jeremy@jcline.org>
Karolina Surma <ksurma@redhat.com>
Kevin Fenzi <kevin@scrye.com>
Lukáš Zachar <lzachar@redhat.com>
Lumir Balhar <lbalhar@redhat.com>
Miro Hrončok <miro@hroncok.cz>
Petr Viktorin <pviktori@redhat.com>
Ralph Bean <rbean@redhat.com>
Randy Barlow <randy@electronsweatshop.com>
Rex Dieter <rdieter@math.unl.edu>
Robert Kuska <rkuska@redhat.com>
Slavek Kabrda <bkabrda@redhat.com>
Stephen Gallagher <sgallagh@redhat.com>
Tomáš Hrnčiar <thrnciar@redhat.com>
Tom Callaway <spot@fedoraproject.org>
Toshio Kuratomi <toshio@fedoraproject.org>
Yaakov Selkowitz <yselkowi@redhat.com>
yatinkarel <ykarel@redhat.com>
91 lines
2.9 KiB
RPMSpec
91 lines
2.9 KiB
RPMSpec
%global python3_pkgversion 3.14
|
||
|
||
# When bootstrapping Python, we cannot test this yet
|
||
# RHEL does not include the test dependencies
|
||
%bcond tests %{undefined rhel}
|
||
# The extras are disabled on RHEL to avoid pysocks and deprecated requests[security]
|
||
%bcond extras %[%{undefined rhel} || %{defined eln}]
|
||
%bcond extradeps %{undefined rhel}
|
||
|
||
Name: python%{python3_pkgversion}-requests
|
||
Version: 2.32.5
|
||
Release: %autorelease
|
||
Summary: HTTP library, written in Python, for human beings
|
||
|
||
License: Apache-2.0
|
||
URL: https://pypi.io/project/requests
|
||
Source: https://github.com/requests/requests/archive/v%{version}/requests-v%{version}.tar.gz
|
||
|
||
# Explicitly use the system certificates in ca-certificates.
|
||
# https://bugzilla.redhat.com/show_bug.cgi?id=904614
|
||
Patch: system-certs.patch
|
||
|
||
# Add support for IPv6 CIDR in no_proxy setting
|
||
# This functionality is needed in Openshift and it has been
|
||
# proposed for upstream in 2021 but the PR unfortunately stalled.
|
||
# Upstream PR: https://github.com/psf/requests/pull/5953
|
||
# This change is backported also into RHEL 9.4 (via CS)
|
||
Patch: support_IPv6_CIDR_in_no_proxy.patch
|
||
|
||
BuildArch: noarch
|
||
BuildRequires: python%{python3_pkgversion}-devel
|
||
%if %{with tests}
|
||
BuildRequires: python%{python3_pkgversion}-pytest
|
||
BuildRequires: python%{python3_pkgversion}-pytest-httpbin
|
||
BuildRequires: python%{python3_pkgversion}-pytest-mock
|
||
BuildRequires: python%{python3_pkgversion}-trustme
|
||
%endif
|
||
|
||
%description
|
||
Most existing Python modules for sending HTTP requests are extremely verbose and
|
||
cumbersome. Python’s built-in urllib2 module provides most of the HTTP
|
||
capabilities you should need, but the API is thoroughly broken. This library is
|
||
designed to make HTTP requests easy for developers.
|
||
|
||
|
||
%if %{with extras}
|
||
%pyproject_extras_subpkg -n python%{python3_pkgversion}-requests security socks
|
||
%endif
|
||
|
||
|
||
%generate_buildrequires
|
||
%pyproject_buildrequires %{?with_extradeps:-x security,socks}
|
||
|
||
|
||
%prep
|
||
%autosetup -p1 -n requests-%{version}
|
||
|
||
# env shebang in nonexecutable file
|
||
sed -i '/#!\/usr\/.*python/d' src/requests/certs.py
|
||
|
||
# Some doctests use the internet and fail to pass in Koji. Since doctests don't have names, I don't
|
||
# know a way to skip them. We also don't want to patch them out, because patching them out will
|
||
# change the docs. Thus, we set pytest not to run doctests at all.
|
||
sed -i 's/ --doctest-modules//' pyproject.toml
|
||
|
||
|
||
%build
|
||
%pyproject_wheel
|
||
|
||
|
||
%install
|
||
%pyproject_install
|
||
%pyproject_save_files -l requests
|
||
|
||
|
||
%check
|
||
%pyproject_check_import
|
||
%if %{with tests}
|
||
# test_unicode_header_name - reported: https://github.com/psf/requests/issues/6734
|
||
# test_use_proxy_from_environment needs pysocks
|
||
%pytest -v tests -k "not test_unicode_header_name %{!?with_extradeps:and not test_use_proxy_from_environment}"
|
||
%endif
|
||
|
||
|
||
%files -n python%{python3_pkgversion}-requests -f %{pyproject_files}
|
||
%doc README.md HISTORY.md
|
||
|
||
|
||
%changelog
|
||
%autochangelog
|