%global         pypi_name       hawkmoth
%global         forgeurl        https://github.com/jnikula/hawkmoth
Version:        0.18.0
%global         tag             %{version}
%forgemeta

Name:           python-%{pypi_name}
Release:        1%{?dist}
Summary:        Sphinx Autodoc for C

License:        BSD-2-Clause
URL:            https://jnikula.github.io/hawkmoth/
Source0:        %{forgesource}

BuildRequires:  python3-devel
# Tests
BuildRequires:  python3-clang
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-xdist)
BuildRequires:  python3dist(strictyaml)
# Documentation
#BuildRequires:  python3dist(sphinx)

BuildArch: noarch

%global _description %{expand:
Hawkmoth is a minimalistic Sphinx C and C++ Domain autodoc
directive extension to incorporate formatted C and C++ source
code comments written in reStructuredText into Sphinx based
documentation. It uses Clang Python Bindings for parsing, and
generates C and C++ Domain directives for C and C++ API
documentation, and more. In short, Hawkmoth is Sphinx Autodoc
for C/C++.

Hawkmoth aims to be a compelling alternative for documenting
C and C++ projects using Sphinx, mainly through its simplicity
of design, implementation and use.}

%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}

%description -n python3-%{pypi_name} %_description

%package doc
Summary:        %{summary}

%description doc
Documentation files for %{pypi_name}

%prep
%forgeautosetup

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel

# Build documentation
# needs hawkmoth, skip for now
#sphinx-build -b man doc man1

%install
%pyproject_install
%pyproject_save_files %{pypi_name}

%check
# cli, parser and cautodoc tests fail
%pyproject_check_import

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst
%{_bindir}/hawkmoth

%files doc
%license LICENSE
%doc doc/*.rst

%changelog
* Sat Oct 05 2024 Benson Muite <benson_muite@emailplus.org> - 0.18.0-1
- Initial packaging