# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=lxml
pkgbase="python-${_realname}"
pkgname=("python-${_realname}")
pkgver=6.0.2
pkgrel=1
pkgdesc="Python binding for the libxml2 and libxslt libraries"
arch=('i686' 'x86_64')
url="https://lxml.de/"
msys2_repository_url="https://github.com/lxml/lxml"
msys2_references=(
  "purl: pkg:pypi/lxml"
  "cpe: cpe:/a:lxml:lxml"
)
license=('spdx:BSD-3-Clause')
depends=("python" "libxslt" "libxml2")
makedepends=(
  "gcc"
  "cython"
  "libxslt-devel"
  "libxml2-devel"
  "pkgconf"
  "python-setuptools"
  "python-build"
  "python-installer"
)
source=("https://github.com/lxml/lxml/archive/${_realname}-${pkgver}.tar.gz")
sha256sums=('21f2931fc1aa3c26f2caa40742e9dd491d3c368f1ceec3c341929abff3023535')

prepare() {
  mv "lxml-lxml-${pkgver}" "lxml-${pkgver}"
  cd "${_realname}-${pkgver}"
}

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

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

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

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

  install -Dm644 LICENSES.txt "${pkgdir}/usr/share/licenses/python-${_realname}/LICENSES.txt"
}
