%global python3_pkgversion 3.11 %global srcname Automat %global libname automat %global common_description %{expand: Automat is a library for concise, idiomatic Python expression of finite-state automata (particularly deterministic finite-state transducers).} Name: python-%{srcname} Version: 22.10.0 Release: 2.ac15.py3.11%{?dist} Summary: Self-service finite-state machines for the programmer on the go License: MIT URL: https://github.com/glyph/automat Source0: %pypi_source BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}dist(sphinx-rtd-theme) %description %{common_description} %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} Provides: python3-%{libname} %description -n python%{python3_pkgversion}-%{srcname} %{common_description} %package -n python-%{srcname}-doc Summary: Automat documentation %description -n python-%{srcname}-doc Documentation for Automat %prep %autosetup -p1 -n %{srcname}-%{version} # Backport of https://github.com/glyph/automat/commit/2bf0abddd9b532ef9dd90707a10a09ce48c24f3d sed -i "s/py\.test/pytest/g" tox.ini %generate_buildrequires %pyproject_buildrequires -t %build %pyproject_wheel PYTHONPATH=%{pyproject_build_lib} sphinx-build-%{python3_pkgversion} docs html # remove the sphinx-build-%{python3_pkgversion} leftovers rm -rf html/.{doctrees,buildinfo} %install %pyproject_install %pyproject_save_files %{libname} %check 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} %{_bindir}/automat-visualize-%{python3_pkgversion} %files -n python-%{srcname}-doc %doc html %license LICENSE %changelog * Sun May 05 2024 Ding-Yi Chen - 22.10.0-2.ac15.py3.11 - Cut corner packaging