SUMMARY="Functional testing framework for command line applications"
DESCRIPTION="Cram is a functional testing framework for command line \
applications. Cram tests look like snippets of interactive shell sessions. \
Cram runs each command and compares the command output in the test with \
the command's actual output."
HOMEPAGE="https://bitheap.org/cram/"
COPYRIGHT="2010-2016 Rafael G. Martins"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://bitheap.org/cram/cram-$portVersion.tar.gz"
CHECKSUM_SHA256="7da7445af2ce15b90aad5ec4792f857cef5786d71f14377e9eb994d8b8337f2f"

ARCHITECTURES="any"

PROVIDES="
	$portName = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"

PYTHON_PACKAGES=(python python3)
PYTHON_VERSIONS=(2.7 3.7)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
	${portName}_$pythonPackage = $portVersion\n\
	cmd:${portName}${pythonVersion%%.*} = $portVersion\
	\"; \
REQUIRES_$pythonPackage=\"\
	haiku\n\
	cmd:python$pythonVersion\
	\""
BUILD_REQUIRES="$BUILD_REQUIRES
	setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	cmd:python$pythonVersion"
done

INSTALL()
{
	for i in "${!PYTHON_PACKAGES[@]}"; do
		pythonPackage=${PYTHON_PACKAGES[i]}
		pythonVersion=${PYTHON_VERSIONS[$i]}

		python=python$pythonVersion
		installLocation=$prefix/lib/$python/vendor-packages/
		export PYTHONPATH=$installLocation:$PYTHONPATH
		mkdir -p $installLocation
		rm -rf build
		$python setup.py build install \
			--root=/ --prefix=$prefix

		mv $prefix/bin/cram $prefix/bin/cram${pythonVersion%%.*}

		packageEntries  $pythonPackage \
			$prefix/bin \
			$prefix/lib/python*
	done
}
