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

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYPI_PN=${PN/-/_}
PYTHON_COMPAT=( python3_{12..14} )

inherit distutils-r1 pypi

DESCRIPTION="BuildBot Worker Daemon"
HOMEPAGE="
	https://buildbot.net/
	https://github.com/buildbot/buildbot
	https://pypi.org/project/buildbot-worker/
"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
# there are tests, but I don't care for now because of deps
RESTRICT="test"

# dev-python/autobahn is only needed by the msgpack_experimental_v7 protocol,
# and for now we don't want to package it.
RDEPEND="
	dev-python/twisted[ssl,${PYTHON_USEDEP}]
"

PATCHES=(
	"${FILESDIR}"/${P}-lazy-msgpack.patch
)

src_prepare() {
	sed -e "/'autobahn >= /d" -e "/'msgpack >= /d" -i setup.py || die # see above
	sed -i setup.py -e "/'buildbot_worker_windows_service=/d" || die # windows only
	distutils-r1_src_prepare
}

python_install_all() {
	distutils-r1_python_install_all
	doman docs/buildbot-worker.1
}
