# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=python-setproctitle
pkgver=1.3.7
pkgrel=1
pkgdesc="Allows a python process to change its process title"
license=("BSD-3-Clause")
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' 'aarch64')
source=(https://files.pythonhosted.org/packages/source/s/setproctitle/setproctitle-$pkgver.tar.gz)
sha256sums=('bc2bc917691c1537d5b9bca1468437176809c7e11e5694ca79a9ca12345dcb9e')

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 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
