%global srcname cppy

Name:           python-%{srcname}
Version:        1.2.1
Release:        %autorelease
Summary:        C++ headers for C extension development

License:        BSD
URL:            https://github.com/nucleic/cppy
Source0:        %pypi_source

BuildArch:      noarch

BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_version}dist(pytest)

%description
A small C++ header library which makes it easier to write Python extension
modules. The primary feature is a PyObject smart pointer which automatically
handles reference counting and provides convenience methods for performing
common object operations.


%package -n     python%{python3_pkgversion}-%{srcname}
Summary:        %{summary}

%description -n python%{python3_pkgversion}-%{srcname}
A small C++ header library which makes it easier to write Python extension
modules. The primary feature is a PyObject smart pointer which automatically
handles reference counting and provides convenience methods for performing
common object operations.


%package -n python-%{srcname}-doc
Summary:        cppy documentation

BuildRequires:  python%{python3_version}dist(sphinx)
BuildRequires:  python%{python3_version}dist(sphinx-rtd-theme)

%description -n python-%{srcname}-doc
Documentation for cppy


%prep
%autosetup -n %{srcname}-%{version}

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

# generate html docs
PYTHONPATH="%{pyproject_build_lib}" sphinx-build-3 docs/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%pyproject_install
%pyproject_save_files %{srcname}

%check
%{pytest} tests

%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files}
%doc README.rst

%files -n python-%{srcname}-doc
%doc html
%license LICENSE

%changelog
%autochangelog