# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Simon Hanna <simon dot hanna AT serve-me DOT info>

pkgname=python-zope-component
_pkgname=zope.component
pkgver=7.1
pkgrel=1
pkgdesc="Represents the core of the Zope Component Architecture"
arch=('any')
url="https://github.com/zopefoundation/zope.component"
license=('ZPL-2.1')
depends=(
  'python'
  'python-setuptools'
  'python-zope-event'
  'python-zope-hookable'
  'python-zope-interface'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-wheel'
)
checkdepends=(
  'python-persistent'
  'python-pytest'
  'python-zope-configuration'
  'python-zope-i18nmessageid'
  'python-zope-location'
  'python-zope-proxy'
  'python-zope-security'
  'python-zope-testrunner'
)
optdepends=(
  'python-persistent: for persistent registry'
  'python-zope-configuration: for zcml'
  'python-zope-i18nmessageid: for zcml'
  'python-zope-location: for security'
  'python-zope-proxy: for security'
  'python-zope-security: for security'
)
source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('1e2c26a6aa2fefec1b93aff7f3d1f437cd4c5ada11b8f87c13e0714ab8aa952face8dddaa0b37ef0f0093156f199f600f6a3fb6e447ad1f74db8d035fcd4fa26')
b2sums=('34eea0fa1ae6b1c1d3fffca0c6943197da62dc5d00a497b487b871363c529f02de929d1f1c3a4d4c81db0b6e930c1a8a692a20a26cadd0c3dbf5b5f6a438ca9f')

build() {
  cd $_pkgname-$pkgver
  python -m build --wheel --no-isolation --skip-dependency-check
}

check() {
  cd $_pkgname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m zope.testrunner -vc --test-path src/
}

package() {
  cd $_pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
