SUMMARY="Free, distributed source control management tool"
DESCRIPTION="Mercurial (hg) is a free, distributed source control management \
tool."
HOMEPAGE="https://www.mercurial-scm.org/"
COPYRIGHT="2005-2022 Matt Mackall et al."
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://www.mercurial-scm.org/release/mercurial-$portVersion.tar.gz"
CHECKSUM_SHA256="05fd0b480389c96547f5a6c769e90ee00f1d13f7ac0d465e40a381c6cf3a56e2"
PATCHES="mercurial-$portVersion.patch"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PYTHON_VERSION="3.8"

PROVIDES="
	mercurial$secondaryArchSuffix = $portVersion
	cmd:hg
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:nano
	cmd:python$PYTHON_VERSION
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:gettext
	cmd:msgfmt
	cmd:python$PYTHON_VERSION
	"

TEST_REQUIRES="
	cmd:diff
	cmd:find
	cmd:which
	"

BUILD()
{
	$portPackageLinksDir/cmd~python$PYTHON_VERSION/bin/python$PYTHON_VERSION setup.py build --force
}

INSTALL()
{
	$portPackageLinksDir/cmd~python$PYTHON_VERSION/bin/python$PYTHON_VERSION setup.py install \
		--prefix="$prefix" --force
}

TEST()
{
	cd tests
	python$PYTHON_VERSION run-tests.py
}
