# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..15} )

inherit distutils-r1 pypi systemd

DESCRIPTION="A guided interface for composing esphome device configs, exploring components and boards, managing automations, and pushing firmware updates"
HOMEPAGE="
	https://esphome.io/
	https://github.com/esphome/device-builder
	https://pypi.org/project/esphome-device-builder/
"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	=dev-python/esphome-device-builder-frontend-0.1.271[${PYTHON_USEDEP}]
	>=dev-python/esphome-2026.7.2[${PYTHON_USEDEP}]

	>=dev-python/aiohttp-3.9.0[${PYTHON_USEDEP}]
	>=dev-python/aiohttp-asyncmdnsresolver-0.1.1[${PYTHON_USEDEP}]
	>=dev-python/colorlog-6.8.0[${PYTHON_USEDEP}]
	>=dev-python/cryptography-42.0.2[${PYTHON_USEDEP}]
	>=dev-python/fnv-hash-fast-2.0.0[${PYTHON_USEDEP}]
	>=dev-python/ifaddr-0.2.0[${PYTHON_USEDEP}]
	>=dev-python/icmplib-3.0.4[${PYTHON_USEDEP}]
	>=dev-python/mashumaro-3.13[${PYTHON_USEDEP}]
	>=dev-python/orjson-3.9.0[${PYTHON_USEDEP}]
	>=dev-python/pyyaml-6.0[${PYTHON_USEDEP}]
	>=dev-python/ruamel-yaml-0.18[${PYTHON_USEDEP}]
	>=dev-python/voluptuous-0.13.1[${PYTHON_USEDEP}]
	>=dev-python/zeroconf-0.150.0[${PYTHON_USEDEP}]

	acct-user/esphome
	acct-group/esphome
"

src_install() {
	distutils-r1_src_install

	systemd_newunit "${FILESDIR}/esphome-device-builder.service" "esphome-device-builder.service"
}


pkg_postinst() {
	elog "Start service with: systemctl enable --now esphome-device-builder"
}