SUMMARY="A simple Python module to parse ISO 8601 dates"
DESCRIPTION="The \"iso8601\" module parses the most common forms of ISO 8601 \
date strings (e.g. 2007-01-14T20:34:22+00:00) into datetime objects."
HOMEPAGE="https://pyiso8601.readthedocs.io/
	https://bitbucket.org/micktwomey/pyiso8601
	https://pypi.org/project/iso8601/"
COPYRIGHT="2007-2017 Michael Twomey"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://files.pythonhosted.org/packages/source/i/iso8601/iso8601-$portVersion.tar.gz"
CHECKSUM_SHA256="49c4b20e1f38aa5cf109ddcd39647ac419f928512c869dc01d5c7098eddede82"

ARCHITECTURES="any"

PROVIDES="
	iso8601 = $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:pip$pythonVersion\n\
	\"; \
REQUIRES_$pythonPackage=\"\
	haiku\n\
	cmd:python$pythonVersion\n\
	setuptools_$pythonPackage\n\
	\""
BUILD_REQUIRES="$BUILD_REQUIRES
	setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	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

	install -m 755 -d "$docDir"
	install -m 644 -t "$docDir" README.rst
}

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

		cd "$sourceDir"-$pythonPackage

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