# Maintainer: Butui Hu <hot123tea123@gmail.com>
# Maintainer: Ashley Bone <ashley DOT bone AT pm DOT me>

pkgname=python-portalocker
_pkgname=portalocker
pkgver=4.1.0
pkgrel=1
pkgdesc='An extended version of portalocker to lock files in Python using the with statement'
arch=('any')
url='https://github.com/WoLpH/portalocker'
license=('BSD-3-Clause')
makedepends=(
  python-build
  python-installer
  python-wheel
  python-uv-build
)
source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/wolph/portalocker/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('b52aa215fbb74185bbda93d75d08361af425b7237529994566e32c7002d88ef0')

prepare() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  sed -i "s/'uv_build[^']*'/'uv_build'/" pyproject.toml
}

build() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
# vim:set ts=2 sw=2 et:
