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

_realname='hatchling'
pkgname="python-${_realname}"
pkgver=1.32.0
pkgrel=1
pkgdesc='A modern project, package, and virtual env manager (backend)'
arch=('any')
url='https://hatch.pypa.io'
msys2_repository_url='https://github.com/pypa/hatch'
msys2_documentation_url='https://hatch.pypa.io'
msys2_changelog_url='https://hatch.pypa.io/latest/history/hatchling'
msys2_references=(
  'anitya: 185085'
  'archlinux: python-hatchling'
  'gentoo: dev-python/hatchling'
  'purl: pkg:pypi/hatchling'
)
license=('spdx:MIT')
depends=(
  'python'
  'python-editables'
  'python-packaging'
  'python-pathspec'
  'python-pluggy'
  'python-tomlkit'
  'python-trove-classifiers'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('0bdbde4a52b06c37e3eca395f85a762bf0ef06fe374fd8ae429dc6be10230f5f')

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

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

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

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

  install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}
