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