%bcond_with check

Name:           gi-docgen
Version:        2022.1
Release:        1
Summary:        Documentation tool for GObject-based libraries
License:        (ASL 2.0 or GPLv3+) and MIT and CC0
URL:            https://gitlab.gnome.org/GNOME/gi-docgen
Source0:        https://download.gnome.org/sources/gi-docgen/2022/gi-docgen-%{version}.tar.xz
Patch0:         gi-docgen-2021.8-no-web-fonts.patch

BuildArch:      noarch

BuildRequires:  meson
BuildRequires:  python3-setuptools
BuildRequires:  python3-jinja2
BuildRequires:  python3-markdown
BuildRequires:  python3-markupsafe
BuildRequires:  python3-pygments
BuildRequires:  python3-toml
#BuildRequires:  python3-typogrify
BuildRequires:  python3-wheel
BuildRequires:  python3-devel
BuildRequires:  python3dist(pytest)

%description
GI-DocGen is a document generator for GObject-based libraries. GObject is
the base type system of the GNOME project. GI-Docgen reuses the
introspection data generated by GObject-based libraries to generate the API
reference of these libraries, as well as other ancillary documentation.

%prep
#%setup -q
%autosetup -p1
# Remove all bundled fonts. See Patch0.
find . -type f \( -name '*.woff' -o -name '*.woff2' \) -print -delete

%build
%py3_build

%install
%py3_install

%if %{with check}
%check
export PYTHONPATH=%{buildroot}%{python3_sitelib}
%meson_test
%endif

%files
%{_bindir}/%{name}
%{_datadir}/pkgconfig/gi-docgen.pc
%{_mandir}/man1/%{name}.1.*
%{python3_sitelib}/gidocgen/
%{python3_sitelib}/gi_docgen-%{version}-py%{python3_version}.egg-info/

%changelog
* Mon Mar 28 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 2022.1-1
- Initial packaging
