SUMMARY="Functions to make basic image processing easier with OpenCV"
DESCRIPTION="A series of convenience functions to make basic image processing \
functions such as translation, rotation, resizing, skeletonization, \
displaying Matplotlib images, sorting contours, detecting edges, and much \
more easier with OpenCV and both Python 2.7 and Python 3."
HOMEPAGE="https://github.com/jrosebr1/imutils"
COPYRIGHT="2015-2016 Adrian Rosebrock"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://files.pythonhosted.org/packages/b5/94/46dcae8c061e28be31bcaa55c560cb30ee9403c9a4bb2659768ec1b9eb7d/imutils-0.5.3.tar.gz"
CHECKSUM_SHA256="857af6169d90e4a0a814130b9b107f5d611150ce440107e1c1233521c6fb1e2b"

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

PROVIDES="
	$portName = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libhdf5$secondaryArchSuffix
	lib:libopencv_core$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libhdf5$secondaryArchSuffix
	devel:libopencv_core$secondaryArchSuffix
	"

PYTHON_PACKAGES=(python3 python38 python39)
PYTHON_VERSIONS=(3.7 3.8 3.9)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
	${portName}_$pythonPackage = $portVersion\n\
	cmd:range_detector$pythonVersion\n\
	\"; \
REQUIRES_$pythonPackage=\"\
	haiku$secondaryArchSuffix\n\
	cmd:cython$pythonVersion$secondaryArchSuffix\n\
	cmd:python$pythonVersion\
	\""
BUILD_REQUIRES="$BUILD_REQUIRES
	setuptools_$pythonPackage
	"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	cmd:cython$pythonVersion$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:gfortran$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	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/range-detector $prefix/bin/range_detector$pythonVersion

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