%global python3_pkgversion 3.11 %global srcname hpack %global common_description %{expand: HTTP/2 Header Encoding for Python This module contains a pure-Python HTTP/2 header encoding (HPACK) logic for use in Python programs that implement HTTP/2. It also contains a compatibility layer that automatically enables the use of nghttp2 if it's available.} Name: python-%{srcname} Version: 4.0.0 Release: 2.ac14.py3.11%{?dist} Summary: Pure-Python HPACK header compression License: MIT URL: http://hyper.rtfd.org VCS: https://github.com/python-hyper/hpack Source0: %vcs/archive/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: make BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}dist(hypothesis) BuildRequires: python%{python3_pkgversion}dist(pytest) BuildRequires: python%{python3_pkgversion}dist(sphinx) %description %{common_description} %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} %description -n python%{python3_pkgversion}-%{srcname} %{common_description} %package doc Summary: Documentation for %{name} %description doc %{common_description} This is the documentation package for %{name}. %prep %autosetup -p1 -n %{srcname}-%{version} %generate_buildrequires # Upstream uses tox to call pytest. If we used it we'd have to patch out # pytest-xdist, pytest-cov, and coverage related pytest flags. Instead, we'll # just call pytest directly. %pyproject_buildrequires %build %pyproject_wheel # generate html docs PYTHONPATH=${PWD} sphinx-build-%{python3_pkgversion} docs/source html # remove the sphinx-build-%{python3_pkgversion} leftovers rm -rf html/.{doctrees,buildinfo} %install %pyproject_install %pyproject_save_files %{srcname} %if %{with check} %check %pytest -k 'not test_get_by_index_out_of_range' %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}-%{srcname} -f %{pyproject_files} %files doc %doc html %license LICENSE %changelog * Thu Apr 18 2024 Ding-Yi Chen - 4.0.0-2.ac14.py3.11 - Cut corner packaging