SUMMARY="A Python library for creating high quality charts"
DESCRIPTION="PyChart is a Python library for creating professional quality \
PS, PDF, PNG, or SVG charts. It supports line plots, bar plots, range-fill \
plots, and pie charts."
HOMEPAGE="https://github.com/Infinite-Code/PyChart
	https://pypi.org/project/Python-Chart/"
COPYRIGHT="1999-2006 Yasushi Saito"
LICENSE="GNU GPL v2"
REVISION="3"
srcGitRev="b4613586ba193a1c8860e1e06c0190246325236b"
SOURCE_URI="https://github.com/Infinite-Code/PyChart/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="7c8d7d0b7ca0843b07f1780382a161990b97e998f8b45a8f0ff91c1cf449343c"
SOURCE_FILENAME="PyChart-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="PyChart-$srcGitRev"

ARCHITECTURES="any"

PROVIDES="
	pychart = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	setuptools_python
	setuptools_python3
	"
BUILD_PREREQUIRES="
	cmd:python
	cmd:python3
	"

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
		\""
	eval "REQUIRES_$pythonPackage=\"
		haiku
		cmd:python$pythonVersion
		\""
done

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

		rm -rf "$sourceDir"-$pythonPackage
		cp -a "$sourceDir" "$sourceDir"-$pythonPackage
		cd "$sourceDir"-$pythonPackage

		python=python$pythonVersion
		$python setup.py build
	done
}

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

		cd "$sourceDir"-$pythonPackage

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

		packageEntries $pythonPackage \
			"$prefix"/lib/$python
	done
}
