Disable extras on RHEL, explicitly BuildRequire them on Fedora

Once urllib3 stops pulling in pysocks by default,
a test would fail without an explicit dependency.
This commit is contained in:
Miro Hrončok 2023-10-10 14:04:07 +02:00
parent 92130db632
commit 85302c38d7

View File

@ -1,10 +1,12 @@
# When bootstrapping Python, we cannot test this yet # When bootstrapping Python, we cannot test this yet
# RHEL does not include the test dependencies # RHEL does not include the test dependencies
%bcond tests %{undefined rhel} %bcond tests %{undefined rhel}
# The extras are disabled on RHEL to avoid pysocks and deprecated requests[security]
%bcond extras %{undefined rhel}
Name: python-requests Name: python-requests
Version: 2.28.2 Version: 2.28.2
Release: 6%{?dist} Release: 7%{?dist}
Summary: HTTP library, written in Python, for human beings Summary: HTTP library, written in Python, for human beings
License: Apache-2.0 License: Apache-2.0
@ -44,10 +46,12 @@ cumbersome. Pythons built-in urllib2 module provides most of the HTTP
capabilities you should need, but the API is thoroughly broken. This library is capabilities you should need, but the API is thoroughly broken. This library is
designed to make HTTP requests easy for developers. designed to make HTTP requests easy for developers.
%if %{with extras}
%pyproject_extras_subpkg -n python%{python3_pkgversion}-requests security socks %pyproject_extras_subpkg -n python%{python3_pkgversion}-requests security socks
%endif
%generate_buildrequires %generate_buildrequires
%pyproject_buildrequires %pyproject_buildrequires %{?with_extras:-x security,socks}
%prep %prep
@ -73,7 +77,8 @@ sed -i 's/ --doctest-modules//' pyproject.toml
%if %{with tests} %if %{with tests}
%check %check
%pytest -v # test_use_proxy_from_environment needs pysocks
%pytest -v %{!?with_extras:-k "not test_use_proxy_from_environment"}
%endif %endif
@ -83,6 +88,10 @@ sed -i 's/ --doctest-modules//' pyproject.toml
%changelog %changelog
* Tue Oct 10 2023 Miro Hrončok <mhroncok@redhat.com> - 2.28.2-7
- Do not package requests[security] and requests[socks] on RHEL
- Make the package build even when urllib3 won't pull in pysocks
* Tue Aug 08 2023 Karolina Surma <ksurma@redhat.com> - 2.28.2-6 * Tue Aug 08 2023 Karolina Surma <ksurma@redhat.com> - 2.28.2-6
- Declare the license as an SPDX expression - Declare the license as an SPDX expression