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

_realname=dulwich
pkgname="python-${_realname}"
pkgver=0.24.6
pkgrel=1
pkgdesc='Pure-Python implementation of the Git file formats and protocols'
arch=('any')
url='https://www.dulwich.io'
msys2_repository_url='https://github.com/jelmer/dulwich'
msys2_changelog_url='https://github.com/jelmer/dulwich/blob/master/NEWS'
msys2_references=(
  'archlinux: python-dulwich'
  'gentoo: dev-python/dulwich'
  'purl: pkg:pypi/dulwich'
)
license=('spdx:Apache-2.0 OR GPL-2.0-or-later')
depends=(
  'python'
  'python-urllib3'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-setuptools-rust'
  'python-devel'
  'rust'
  'gcc'
)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('e8aebdb52cee481ddc038a2b88376bc28767127fdf3e5ea08b52ae1f60e1e15b')

prepare(){
  cd "${srcdir}/${_realname}-${pkgver}"
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

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

  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
