# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=python-setproctitle
pkgver=1.3.3
pkgrel=2
pkgdesc="Allows a python process to change its process title"
license=("BSD")
url="https://github.com/dvarrazzo/py-setproctitle"
depends=('python')
makedepends=(python-setuptools python-wheel python-build python-installer)
checkdepends=('python-pytest' 'procps-ng')
arch=(x86_64 powerpc64le powerpc riscv64)
source=(https://files.pythonhosted.org/packages/source/s/setproctitle/setproctitle-$pkgver.tar.gz)
sha256sums=('c913e151e7ea01567837ff037a23ca8740192880198b7fbb90b16d181607caae')

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

check() {
    local _pyver=$(python -c "import sys; print('{0}{1}'.format(*sys.version_info[:2]))")
    cd "$srcdir"/setproctitle-$pkgver/build/lib.linux-$CARCH-cpython-$_pyver
    python -m pytest ../../tests
}

package_python-setproctitle() {
    cd "$srcdir"/setproctitle-$pkgver
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -m0644 -D COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
}
