Add conditionals for EPEL9 support

This commit is contained in:
Benjamin A. Beasley 2022-10-13 10:12:10 -04:00
parent 8da4100e97
commit 5781864988
1 changed files with 46 additions and 6 deletions

View File

@ -1,4 +1,11 @@
%bcond_without tests
%if 0%{?el9}
# Please branch and build python-aiodns in epel9
# https://bugzilla.redhat.com/show_bug.cgi?id=2134149
%bcond_with speedups
%else
%bcond_without speedups
%endif
Name: python-aiohttp
Version: 3.8.3
@ -31,11 +38,15 @@ with middlewares and pluggable routing.}
%package -n python3-aiohttp
Summary: %{summary}
%if %{with speedups}
Recommends: python3-aiohttp+speedups
%endif
%description -n python3-aiohttp %{common_description}
%if %{with speedups}
%pyproject_extras_subpkg -n python3-aiohttp speedups
%endif
%prep
%autosetup -p 1 -n aiohttp-%{version}
@ -60,12 +71,28 @@ sed -r -i \
-e 's/==[^#;]+//' \
-e 's/^(proxy[-\.]py|python-on-whales|wait-for-it)/# &/' \
-e 's/^(coverage|pytest-cov|mypy)/# &/' \
-e 's/^(setuptools-git)/# &/' \
requirements/*.txt
%if 0%{?el9}
# The python-cchardet package, specified for Python 3.9 and older, was never
# built for EPEL9, and was orphaned and retired in F37. It should be fine to
# patch this out of the “speedups” extra, as python-charset-normalizer should
# do the same job anyway.
sed -r -i 's/^[[:blank:]]*cchardet;/# &/' setup.cfg requirements/*.txt
# Please branch and build python-re-assert in epel9
# https://bugzilla.redhat.com/show_bug.cgi?id=2134200
# Please branch and build python-regex in epel9
# https://bugzilla.redhat.com/show_bug.cgi?id=2134229
sed -r -i 's/^[[:blank:]]*re.assert/# &/' requirements/*.txt
%endif
%if %{without speedups}
sed -r -i 's/^[[:blank:]]*aiodns;/# &/' setup.cfg requirements/*.txt
%endif
# Remove files generated by Cython to regenerate them
grep -rl '/\* Generated by Cython' | xargs -r rm -v
%generate_buildrequires
%{pyproject_buildrequires -x speedups \
%{pyproject_buildrequires %{?with_speedups:-x speedups} \
requirements/base.txt %{?with_tests:requirements/test.txt -t}}
%build
@ -99,18 +126,30 @@ rm -rvf .git
export PYTHONSAFEPATH=1
# Setting PYTHONSAFEPATH works only for Python 3.11+, so we must skip any
# affected tests on older Pythons.
if %{python3} -c 'import sys; sys.exit(0 if sys.version_info < (3, 11) else 1)'
then
k="${k-}${k+ and }not test_no_warnings"
fi
%if v"%{python3_version}" < v"3.11"
k="${k-}${k+ and }not test_no_warnings"
%endif
# test_proxy_functional.py requires python3dist(proxy-py)
ignore="${ignore-} --ignore=tests/test_proxy_functional.py"
# test_client_session_timeout_zero requires DNS
k="${k-}${k+ and }not test_client_session_timeout_zero"
# Unexplained flaky error during teardown:
# E RuntimeError: Event loop is closed
k="${k-}${k+ and }not test_static_file_if_match"
k="${k-}${k+ and }not test_static_file_if_none_match"
%pytest --ignore=tests/test_proxy_functional.py -k "${k-}"
%if 0%{?el9}
# The following test modules unconditionally import re_assert.
#
# Please branch and build python-re-assert in epel9
# https://bugzilla.redhat.com/show_bug.cgi?id=2134200
# Please branch and build python-regex in epel9
# https://bugzilla.redhat.com/show_bug.cgi?id=2134229
ignore="${ignore-} --ignore=tests/test_web_response.py"
ignore="${ignore-} --ignore=tests/test_urldispatch.py"
ignore="${ignore-} --ignore=tests/test_streams.py"
ignore="${ignore-} --ignore=tests/test_client_session.py"
%endif
%pytest ${ignore-} -k "${k-}"
%else
%pyproject_check_import -e aiohttp.pytest_plugin
%endif
@ -125,6 +164,7 @@ k="${k-}${k+ and }not test_static_file_if_none_match"
- Port to pyproject-rpm-macros
- Add metapackage for “speedups” extra
- Update License to SPDX
- Add conditionals for EPEL9 support
* Mon Sep 26 2022 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.8.3-1
- Update to 3.8.3