%global python3_pkgversion 3.11 %global debug_package %{nil} # Created by pyp2rpm-3.3.7 %global pypi_name crcmod %global pypi_version 1.7 %global common_description %{expand: The software in this package is a Python module for generating objects that compute the Cyclic Redundancy Check (CRC).} Name: python-%{pypi_name} Version: %{pypi_version} Release: 2.ac16.py3.11%{?dist} Summary: CRC Generator License: MIT URL: http://crcmod.sourceforge.net/ Source0: %{pypi_source} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python3-docs BuildRequires: sed BuildRequires: python%{python3_pkgversion}dist(setuptools) BuildRequires: python%{python3_pkgversion}dist(sphinx) %description %{common_description} %package -n python%{python3_pkgversion}-%{pypi_name} Summary: %{summary} %description -n python%{python3_pkgversion}-%{pypi_name} %{common_description} %package -n python-%{pypi_name}-doc Summary: crcmod documentation BuildArch: noarch %description -n python-%{pypi_name}-doc Documentation for crcmod %prep %autosetup -n %{pypi_name}-%{pypi_version} # Use local intersphinx inventory sed -r \ -e 's|http://docs.python.org|%{_docdir}/python3-docs/html|' \ -i docs/source/conf.py %build %py3_build # 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 %py3_install %check for test in test/*; do PYTHONPATH="%{buildroot}%{python3_sitearch}" %python3 $test done 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}-%{pypi_name} %license LICENSE %{python3_sitearch}/%{pypi_name} %{python3_sitearch}/%{pypi_name}-%{pypi_version}-py%{python3_version}.egg-info %files -n python-%{pypi_name}-doc %doc html %license LICENSE %changelog * Sat May 11 2024 Ding-Yi Chen - %{pypi_version}-2.ac16.py3.11 - Cut corner packaging