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

EAPI=8

DISTUTILS_SINGLE_IMPL="1"
DISTUTILS_USE_PEP517="setuptools"
PYTHON_COMPAT=( python3_{13..15} )

inherit distutils-r1

DESCRIPTION="Helper tool for developing and building postmarketOS"
HOMEPAGE="https://wiki.postmarketos.org/wiki/Pmbootstrap
	https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/"

if [[ "${PV}" == *9999* ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://gitlab.postmarketos.org/postmarketOS/${PN}"
else
	SRC_URI="https://gitlab.postmarketos.org/postmarketOS/${PN}/-/archive/${PV}/${P}.tar.bz2"
	KEYWORDS="~amd64 ~arm64 ~x86"
fi

LICENSE="GPL-3+"
SLOT="0"

RDEPEND="
	>=dev-vcs/git-2.46
	app-alternatives/tar
	sys-apps/util-linux
	sys-fs/multipath-tools
	sys-process/procps
"
BDEPEND="
	${RDEPEND}
"

EPYTEST_DESELECT=(
	# Fails:
	"test/core/test_pkgrepo.py"
	# suspicious XFails:
	"test/core/test_chroot.py"
	# > mkbootimg not found
	"test/parse/test_bootimg.py"
)
EPYTEST_PLUGINS=()
distutils_enable_tests pytest