# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

pkgbase=python-py
pkgname=('python-py')
pkgver=1.11.0
pkgrel=2
pkgdesc="library with cross-python path, ini-parsing, io, code, log facilities"
arch=('any')
license=('spdx:MIT')
url="https://py.readthedocs.io"
depends=('python')
makedepends=(
  'python-setuptools'
  'python-setuptools-scm'
  'python-wheel'
  'python-build'
  'python-installer'
)
provides=("python3-py")
replaces=("python3-py")
conflicts=("python3-py")
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/pytest-dev/py/archive/${pkgver}.tar.gz")
sha512sums=('7307e41e0120b8d4cc9b77fd4b5fc93cb649e05c7bd41002edfead20cf027a32956faffd764dff9a95e97600604ae76b25c472a99b0a44a7842c862c8846717b')

prepare() {
  export LC_CTYPE=en_US.UTF-8
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}

build() {
  cd "${srcdir}/py-${pkgver}"

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

package() {
  cd "${srcdir}/py-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
