# Maintainer: Amir Husayn Panahifar <ahp@panahifar.ir>

pkgname=sshctl
pkgver=0.1.1
pkgrel=1
pkgdesc="SSH configuration management toolkit"
arch=('any')
url="https://src.panahifar.ir/ahp/sshctl"
license=('MIT')
depends=(
    'python-typer'
    'python-rich'
    'python-structlog'
    'python-pydantic'
    'python-pydantic-settings'
    'python-yaml'
)
makedepends=(
    'python-build'
    'python-installer'
    'python-wheel'
    'python-hatchling'
)
checkdepends=(
    'python-pytest'
    'python-pytest-cov'
    'python-pytest-asyncio'
)
source=("$pkgname-$pkgver.tar.gz")
b2sums=('SKIP')

build() {
    cd "$pkgname-$pkgver"
    python -m build --wheel --no-isolation
}

check() {
    cd "$pkgname-$pkgver"
    python -m pytest -o addopts='' tests/ -q
}

package() {
    cd "$pkgname-$pkgver"
    python -m installer --destdir="$pkgdir" dist/*.whl
    if [ -f man/sshctl.1 ]; then
        install -Dm644 man/sshctl.1 -t "$pkgdir/usr/share/man/man1"
    fi
}
