%bcond_without dotests

%global __tar /opt/freeware/bin/tar

%global py_minor 12

%global py_major	3.12

%global python_major python%{py_major}

%global pkgname aiohttp

%global meta_package python3-%{pkgname}

%global python3_sitearch %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")

Name:           %{python_major}-%{pkgname}
Version:	3.13.2
Release:	1
Summary:        Python HTTP client/server for asyncio
License:        Apache-2.0
URL:            https://github.com/aio-libs/aiohttp
Source0:	https://github.com/aio-libs/%{pkgname}/archive/v%{version}/%{pkgname}-%{version}.tar.gz


BuildRequires:  %{python_major}-devel >= %{py_major}.%{py_minor}
BuildRequires:  %{python_major}-setuptools >= 78.0.2
Requires:       %{python_major} >= %{py_major}.%{py_minor}
Requires:	%{python_major}-aiohappyeyeballs >= 2.6.1
Requires:	%{python_major}-aiosignal >= 1.4.0
Requires:	%{python_major}-attrs >= 25.3.0
Requires:	%{python_major}-frozenlist >= 1.8.0
Requires:	%{python_major}-multidict >= 6.7.0
Requires:	%{python_major}-propcache >= 0.4.1
Requires:	%{python_major}-yarl >= 1.22.0


%description
Python HTTP client/server for asyncio which supports both the client and the
server side of the HTTP protocol, client and server websocket, and webservers
with middlewares and pluggable routing.


%package -n %{meta_package}
Summary:	Meta-package for %{name}

Requires:	python3 >= %{py_major}.%{py_minor}
Requires:	%{name} = %{version}-%{release}
Requires:	python3-aiohappyeyeballs >= 2.6.1
Requires:	python3-aiosignal >= 1.4.0
Requires:	python3-attrs >= 25.3.0
Requires:	python3-frozenlist >= 1.8.0
Requires:	python3-multidict >= 6.7.0
Requires:	python3-propcache >= 0.4.1
Requires:	python3-yarl >= 1.22.0


%description -n %{meta_package}
This is a Meta-package for %{name} package.


%prep
%autosetup -n %{pkgname}-%{version}

# Disable test coverage reports
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r -i '/--cov=|-p pytest_cov/d' setup.cfg


%build
#Nothing to build


%install
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
%{python_major} -m pip install . --root %{buildroot} -I --no-deps


%check
%if %{with dotests}

export PYTHONPATH=%{buildroot}%{python3_sitearch}
%{python_major} -m venv python_venv
. python_venv/bin/activate
%{python_major} -m pip install pytest
%{python_major} -m pip install multidict
%{python_major} -m pip install attrs
%{python_major} -m pip install yarl
%{python_major} -m pip install aiohappyeyeballs
%{python_major} -m pip install aiosignal
%{python_major} -m pip install pytest-xdist
%{python_major} -m pip install pytest-mock
cd tests
%{python_major} -m pytest || true
deactivate

%endif


%files
%defattr(-,root,system,-)
%doc CHANGES.rst README.rst
%{python3_sitearch}/*

%files -n %{meta_package}
%defattr(-,root,system,-)

%changelog
* Wed Nov 05 2025 Reshma V Kumar <reskumar@in.ibm.com> - 3.13.2-1
- Initial port to AIX Toolbox
- Build with python 3.12
