# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-lazy-object-proxy
pkgver=1.10.0
pkgrel=3
pkgdesc='A fast and thorough lazy object proxy'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://github.com/ionelmc/python-lazy-object-proxy"
license=('BSD')
depends=("python")
makedepends=('python-setuptools-scm')
checkdepends=('python-pytest-benchmark')
source=("https://github.com/ionelmc/python-lazy-object-proxy/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('618e900b0314b2c39fb3fca21592b4a24216af7044185c413bd06235dc274ebf303299143648e5c026b62f3d0b977b5d31c667f2a31f3a768174915a5c1320bd')

export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver

build() {
  cd python-lazy-object-proxy-$pkgver
  python setup.py build
}

check() {
  cd python-lazy-object-proxy-$pkgver
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-${python_version}" pytest
}

package() {
  cd python-lazy-object-proxy-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
