%global git_date 20241110 %global git_hash 23540c93 %global git_ver 2.32.3 %global rel 1 %global alt_name requests %global src_name %{alt_name}-%{git_date}-%{git_hash}.tar.xz # When bootstrapping Python, we cannot test this yet # RHEL does not include the test dependencies %bcond tests 0 #%{undefined rhel} # The extras are disabled on RHEL to avoid pysocks and deprecated requests[security] %bcond extras %{undefined rhel} Name: python-requests Version: %{git_ver}^%{git_date}g%{git_hash} Release: %{rel}%{?dist} Summary: HTTP library, written in Python, for human beings License: Apache-2.0 URL: https://github.com/psf/requests Source: %{url}/%{src_name} # 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 # Fix FTBFS (test_redirecting_to_bad_url) #Patch: https://github.com/psf/requests/commit/bf24b7.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %if %{with tests} BuildRequires: python3dist(pytest) BuildRequires: python3dist(pytest-httpbin) BuildRequires: python3dist(pytest-mock) BuildRequires: python3dist(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. %package -n python%{python3_pkgversion}-requests Summary: %{summary} %description -n python%{python3_pkgversion}-requests 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_extras:-x security,socks} %prep %autosetup -p1 -n %{alt_name} # env shebang in nonexecutable file #sed -i '/#!\/usr\/.*python/d' 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 # Fix compatibility with pytest 8 # Upstream report: https://github.com/psf/requests/issues/6679 sed -i "/pytest.warns/s/None//" tests/test_requests.py %build %pyproject_wheel %install %pyproject_install %pyproject_save_files requests %check %pyproject_check_import %if %{with tests} # test_use_proxy_from_environment needs pysocks %pytest -v tests %{!?with_extras:-k "not test_use_proxy_from_environment"} %endif %files -n python%{python3_pkgversion}-requests -f %{pyproject_files} %license LICENSE %doc README.md HISTORY.md %changelog