%global python3_pkgversion 3.11 %bcond tests 0 Name: python-httpx Version: 0.27.0 Release: 2.ac14.py3.11%{?dist} Summary: Next-generation HTTP client for Python License: BSD-3-Clause URL: https://github.com/encode/httpx Source0: %{url}/archive/%{version}/httpx-%{version}.tar.gz BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %if %{with tests} # See the Optional charset auto-detection group in requirements.txt: BuildRequires: %{py3_dist chardet} # See the Tests & Linting group in requirements.txt: BuildRequires: %{py3_dist cryptography} BuildRequires: %{py3_dist pytest} BuildRequires: %{py3_dist trio} BuildRequires: %{py3_dist trustme} BuildRequires: %{py3_dist uvicorn} %endif BuildRequires: help2man %global _description %{expand: HTTPX is a fully featured HTTP client library for Python 3. It includes an integrated command line client, has support for both HTTP/1.1 and HTTP/2, and provides both sync and async APIs.} %description %{_description} %package -n python%{python3_pkgversion}-httpx Summary: %{summary} %description -n python%{python3_pkgversion}-httpx %{_description} HTTPX is a fully featured HTTP client for Python, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2. %pyproject_extras_subpkg -n python3-httpx brotli http2 socks %pyproject_extras_subpkg -n python3-httpx cli %{_bindir}/httpx-%{python3_pkgversion} %{_mandir}/man1/httpx-%{python3_pkgversion}.1* %prep %autosetup -n httpx-%{version} %generate_buildrequires %pyproject_buildrequires -x brotli,cli,http2,socks %build %pyproject_wheel %install %pyproject_install %pyproject_save_files httpx install -d '%{buildroot}%{_mandir}/man1' PYTHONPATH='%{buildroot}%{python3_sitelib}' \ PATH="${PATH-}:%{buildroot}%{_bindir}" \ PYTHONDONTWRITEBYTECODE=1 \ help2man --no-info --version-string='%{version}' \ --output='%{buildroot}%{_mandir}/man1/httpx.1' httpx %check %pyproject_check_import %if %{with tests} # These require network access (DNS) k="${k-}${k+ and }not test_async_proxy_close" k="${k-}${k+ and }not test_sync_proxy_close" %pytest -k "${k-}" -v %endif for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-httpx -f %{pyproject_files} %doc CHANGELOG.md %doc README.md %doc README_chinese.md %changelog * Thu Apr 18 2024 Ding-Yi Chen - 0.27.0-2.ac14.py3.11 - Cut corner packaging