%global python3_pkgversion 3.11 # We have source files with intentional syntax errors, in order to test. # Do not fail the build just because some file is not valid python. %undefine _python_bytecompile_errors_terminate_build %global _docdir_fmt python3-zope-testrunner Name: python-zope-testrunner Version: 6.4 Release: 2.ac16.py3.11%{?dist} Summary: Zope testrunner script License: ZPL-2.1 URL: https://pypi.python.org/pypi/zope.testrunner VCS: https://github.com/zopefoundation/zope.testrunner Source0: %{vcs}/archive/%{version}/zope.testrunner-%{version}.tar.gz BuildArch: noarch BuildRequires: help2man BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python3-docs BuildRequires: %{py3_dist manuel} %description This package provides a flexible test runner with layer support. %package -n python%{python3_pkgversion}-zope-testrunner Summary: Zope testrunner script %description -n python%{python3_pkgversion}-zope-testrunner This package provides a flexible test runner with layer support. %package doc # The content is ZPL-2.1. Files added by Sphinx have the following licences: # searchindex.js: BSD-2-Clause # _static/*: BSD-2-Clause, except for the following: # _static/jquery*.js: MIT # _static/underscore*.js: MIT License: ZPL-2.1 AND BSD-2-Clause AND MIT Summary: Documentation for zope.testrunner %description doc Documentation for zope.testrunner. %pyproject_extras_subpkg -n python3-zope-testrunner subunit %prep %autosetup -n zope.testrunner-%{version} -p1 # Update the sphinx HTML theme name sed -i "s/'default'/'classic'/" docs/conf.py # Fix the way python is invoked sed -i 's/python -m/python3 -m/' docs/cli.rst # Use local objects.inv for intersphinx sed -i "s|\('https://docs\.python\.org/': \)None|\1'%{_docdir}/python3-docs/html/objects.inv'|" docs/conf.py # Replace a deprecated directive sed -i "s/autodoc_default_flags.*/autodoc_default_options = {'members': True, 'show-inheritance': True}/" docs/conf.py %generate_buildrequires %pyproject_buildrequires -t -x test,subunit,docs %build %pyproject_wheel rst2html-%{python3_pkgversion} --no-datestamp CHANGES.rst CHANGES.html rst2html-%{python3_pkgversion} --no-datestamp README.rst README.html # Not really RST: https://github.com/zopefoundation/zope.testrunner/issues/100 cp -p COPYRIGHT.rst COPYRIGHT %install %pyproject_install mkdir -p %{buildroot}%{_mandir}/man1 PYTHONPATH=%{buildroot}%{python3_sitelib} \ help2man -s 1 -o %{buildroot}%{_mandir}/man1/zope-testrunner.1 \ -N -n "Zope testrunner script" %{buildroot}%{_bindir}/zope-testrunner # The Sphinx documentation cannot be built with an uninstalled zope.testrunner # because python finds the installed zope package, which doesn't contain # testrunner. We fake out python by copying the entire installed tree to a # local directory and adding this package inside the zope directory. mkdir lib cp -a %{_prefix}/lib/python%{python3_version} lib if [ -d %{_prefix}/lib64/python%{python3_version} ]; then mkdir lib64 cp -a %{_prefix}/lib64/python%{python3_version} lib64 fi mkdir include cp -a %{_includedir}/python%{python3_version}* include cp -a %{buildroot}%{python3_sitelib}/zope* \ lib/python%{python3_version}/site-packages export PYTHONHOME=$PWD:$PWD sphinx-build-%{python3_pkgversion} -b html -d docs/_build/doctrees docs docs/_build/html rm -fr include lib lib64 rm -f docs/_build/html/.buildinfo unset PYTHONHOME %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}-zope-testrunner %doc CHANGES.html README.html %license COPYRIGHT LICENSE.md %{_bindir}/zope-testrunner-%{python3_pkgversion} %{_mandir}/man1/zope-testrunner-%{python3_pkgversion}.1* %{python3_sitelib}/zope.testrunner* %{python3_sitelib}/zope/testrunner/ %exclude %{python3_sitelib}/zope/testrunner/tests %files doc %doc docs/_build/html %changelog * Thu May 16 2024 Ding-Yi Chen - 6.4-2.ac16.py3.11 - Cut corner packaging