# Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # # We can generate PDF documentation as a substitute. %bcond docs 0 %global python3_pkgversion 3.11 Name: python-wrapt Version: 1.16.0 Release: 2.ac12.py3.11%{?dist} Summary: A Python module for decorators, wrappers and monkey patching License: BSD-2-Clause URL: https://github.com/GrahamDumpleton/wrapt Source: %{url}/archive/%{version}/wrapt-%{version}.tar.gz BuildRequires: gcc BuildRequires: python%{python3_pkgversion}-devel # We bypass tox and instead BR and use pytest directly; this is simpler and # avoids the need to patch out coverage analysis # (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters). BuildRequires: %{py3_dist pytest} %global _description %{expand: The aim of the wrapt module is to provide a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions.} %description %_description %package -n python%{python3_pkgversion}-wrapt Summary: %{summary} %description -n python%{python3_pkgversion}-wrapt %_description %if %{with docs} %package doc Summary: Documentation for the wrapt module BuildArch: noarch BuildRequires: make BuildRequires: python%{python3_pkgversion}-sphinx-latex BuildRequires: latexmk # docs/requirements.txt BuildRequires: %{py3_dist sphinx} BuildRequires: %{py3_dist sphinx_rtd_theme} %description doc %{summary}. %endif %prep %autosetup -n wrapt-%{version} %generate_buildrequires %pyproject_buildrequires sed -i -re "s|sphinx-build|sphinx-build-%{python3_pkgversion}|" docs/Makefile %build %pyproject_wheel %if %{with docs} PYTHONPATH="${PWD}" %make_build -C docs latex \ SPHINXOPTS='-j%{?_smp_build_ncpus}' %make_build -C docs/_build/latex LATEXMKOPTS='-quiet' %endif %install %pyproject_install %pyproject_save_files wrapt %check %pytest -v %if %{with docs} 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 doc %license LICENSE %doc docs/_build/latex/wrapt.pdf %endif %files -n python%{python3_pkgversion}-wrapt -f %{pyproject_files} %doc README.rst %changelog * Mon Apr 15 2024 Ding-Yi Chen - 1.16.0-2.ac12.py3.11 - Cut corner packaging