%global python3_pkgversion 3.11 Name: python-flexcache Version: 0.2 Release: 2.ac16.py3.11%{?dist} Summary: Cache on disk the result of expensive calculations License: BSD-3-Clause URL: https://github.com/hgrecco/flexcache Source: %{pypi_source flexcache} # Add setuptools to the runtime dependencies # # This is needed for the “import pkg_resources†in the top-level # __init__.py. # # Downstream-only because version 0.3 of flexcache does not use pkg_resources, # so this is a temporary patch for version 0.2 only. Patch: flexcache-0.2-setuptools.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %global common_description %{expand: A robust and extensible package to cache on disk the result of expensive calculations.} %description %{common_description} %package -n python%{python3_pkgversion}-flexcache Summary: %{summary} %description -n python%{python3_pkgversion}-flexcache %{common_description} %prep %autosetup -n flexcache-%{version} -p1 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters sed -r -i 's/^([[:blank:]]*)\b(pytest-cov)\b/\1# \2/' setup.cfg %generate_buildrequires %pyproject_buildrequires -x test %build %pyproject_wheel %install %pyproject_install %pyproject_save_files flexcache # Upstream probably doesn’t want to install flexcache.testsuite, but we don’t # know how to suggest a fix given “[BUG] options.packages.find.exclude not # taking effect when include_package_data = Trueâ€, # https://github.com/pypa/setuptools/issues/3260. # # Still, we don’t want to install the test suite, so we just remove the files # manually for now. rm -rvf '%{buildroot}%{python3_sitelib}/flexcache/testsuite' sed -r -i '/\/flexcache\/testsuite/d' %{pyproject_files} %check %pytest 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}-flexcache -f %{pyproject_files} %doc README.rst %doc CHANGES %changelog * Fri May 10 2024 Ding-Yi Chen <dingyichen@gmail.com> - 0.2-2.ac16.py3.11 - Cut corner packaging