# Maintainer: edpibu <git@edgarpierre.fr>
pkgname=hasspy-git
pkgver=r3.b46e0db
pkgrel=1
pkgdesc="Home assistant utility"
arch=(any)
url="https://git.edgarpierre.fr/edpibu/hasspy"
license=('GPL-3.0-or-later')
depends=('python-paho-mqtt' 'python-pillow')
makedepends=('git' 'uv' 'python-installer') # 'bzr', 'git', 'mercurial' or 'subversion'
optdepends=('playerctl: Playback control'
			'wireplumber: Volume control'
			'libnotify: Notification support')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
backup=("etc/hasspy/config.toml")
source=('FOLDER::VCS+URL#FRAGMENT')
sha256sums=('SKIP')

source=("git+https://git.edgarpierre.fr/edpibu/hasspy.git")

pkgver() {
	cd "$srcdir/${pkgname%-git}"

	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/${pkgname%-git}"
    uv build
}

package() {
	cd "$srcdir/${pkgname%-git}"

	python -m installer --destdir="${pkgdir}" dist/*.whl
	install -Dm644 config.example.toml "${pkgdir}/etc/${pkgname%-git}/config.toml"
	install -Dm644 ${pkgname%-git}.service "${pkgdir}/usr/lib/systemd/system/${pkgname%-git}.service"
	install -Dm644 icon.svg "${pkgdir}/usr/share/icons/hicolor/scalable/apps/fr.edgarpierre.hasspy.svg"
}