# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_pyname=gi_docgen
pkgname=gi-docgen
pkgver=2024.1
pkgrel=4
pkgdesc="Documentation generator for GObject-based libraries"
url="https://gnome.pages.gitlab.gnome.org/gi-docgen/"
msys2_repository_url="https://gitlab.gnome.org/GNOME/gi-docgen"
arch=(any)
license=("spdx:Apache-2.0 OR GPL-3.0-or-later")
depends=(
  python
  python-jinja
  python-markdown
  python-markupsafe
  python-packaging
  python-pygments
)
makedepends=(
  python-build
  python-installer
  python-setuptools
)
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz"
        "https://gitlab.gnome.org/GNOME/gi-docgen/-/commit/8b4996a85126d9f26d474c6578ae77f065bdb236.patch")
sha256sums=('2a4a5569f91109777481aa71451751289227f7c2652cfac366184a41eb19c231'
            '085740dac566ac6dff96fe31b939af93d8d0152db905e6cb856ac2e3c6edbfd7')

prepare() {
  cd "$_pyname-$pkgver"

  patch -Np1 -i ../8b4996a85126d9f26d474c6578ae77f065bdb236.patch
}

build() {
  cd "$_pyname-$pkgver"

  python -m build --wheel --no-isolation
}

package() {
  cd "$_pyname-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl
}
