# Maintainer: Bruno Pagani <archange@archlinux.org>
# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>
# Contributor: Muflone http://www.muflone.com/contacts/english/
# Contributor: Chris Warrick <aur@chriswarrick.com>

_pkg=cloudpickle
pkgname=python-${_pkg}
pkgver=3.1.2
pkgrel=1
pkgdesc="Extended pickling support for Python objects"
arch=(any)
url="https://github.com/cloudpipe/cloudpickle"
license=(BSD-3-Clause)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-flit-core
  python-wheel
)
checkdepends=(
  python-pytest
  python-psutil
  python-tornado
  python-numpy
)
options=(!emptydirs)
source=($pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz)
sha256sums=('7acae4307459d436eee740eea52ec9056f37b8b907d6aef7b0a97a1ccff90ff9')

build() {
  cd ${_pkg}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd ${_pkg}-${pkgver}
  PYTHONPATH=. pytest .
}

package() {
  cd ${_pkg}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
