%global python3_pkgversion 3.11 # Bconds are needed for Python bootstrap %bcond docs %{undefined rhel} %bcond tests 0 # Install doc subpackage files into the main package doc directory %global _docdir_fmt %{name} Name: python-zope-interface Version: 6.3 Release: 2.ac14.py3.11%{?dist} Summary: Zope 3 Interface Infrastructure License: ZPL-2.1 URL: https://pypi.io/project/zope.interface Source0: https://pypi.io/packages/source/z/zope.interface/zope.interface-%{version}.tar.gz %description Interfaces are a mechanism for labeling objects as conforming to a given API or contract. This is a separate distribution of the zope.interface package used in Zope 3. %package -n python%{python3_pkgversion}-zope-interface Summary: Zope 3 Interface Infrastructure %{?python_provide:%python_provide python3-zope-interface} BuildRequires: gcc BuildRequires: make BuildRequires: python%{python3_pkgversion}-devel %description -n python%{python3_pkgversion}-zope-interface Interfaces are a mechanism for labeling objects as conforming to a given API or contract. This is a separate distribution of the zope.interface package used in Zope 3. %if %{with docs} %package doc Summary: Documentation for zope.interface BuildArch: noarch BuildRequires: python3-docs %description doc Documentation for %{name}. %endif %prep %autosetup -n zope.interface-%{version} -p1 # Update the sphinx theme name sed -i "s/'default'/'classic'/" docs/conf.py # Use local objects.inv for intersphinx sed -i "s|\('https://docs\.python\.org/': \)None|\1'%{_docdir}/python3-docs/html/objects.inv'|" docs/conf.py %generate_buildrequires %pyproject_buildrequires %{?with_docs: -x docs} %{?with_tests: -x test} %build %pyproject_wheel %if %{with docs} # build the sphinx documents PYTHONPATH=$PWD/src make -C docs html rm -f docs/_build/html/.buildinfo %endif %install %pyproject_install # C files don't need to be packaged rm -f %{buildroot}%{python3_sitearch}/zope/interface/_zope_interface_coptimizations.c %if %{with tests} %check # We have to run tests installed together with the package # https://github.com/zopefoundation/zope.interface/issues/196 pushd %{buildroot}%{python3_sitearch} PURE_PYTHON=1 python3 -m unittest discover -s zope/interface -t . popd %endif 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-interface %doc README.rst CHANGES.rst %license COPYRIGHT.txt LICENSE.txt %{python3_sitearch}/zope/interface/ # Co-own %%{python3_sitearch}/zope/ %dir %{python3_sitearch}/zope/ %exclude %{python3_sitearch}/zope/interface/tests/ %exclude %{python3_sitearch}/zope/interface/common/tests/ %{python3_sitearch}/zope.interface-*.dist-info %{python3_sitearch}/zope.interface-*-nspkg.pth %if %{with docs} %files doc %doc docs/_build/html/ %endif %changelog * Mon Apr 22 2024 Ding-Yi Chen - 6.3-2.ac14.py3.11 - Cut corner packaging