SUMMARY="XML/HTML/XHTML Markup safe string for Python"
DESCRIPTION="This package implements a XML/HTML/XHTML Markup safe string \
for Python."
HOMEPAGE="https://pypi.org/project/MarkupSafe/"
COPYRIGHT="2019 Armin Ronacher and contributors"
LICENSE="BSD (3-clause)"
REVISION="2"
SOURCE_URI="https://github.com/pallets/markupsafe/archive/1.1.1.tar.gz"
CHECKSUM_SHA256="222a10e3237d92a9cd45ed5ea882626bc72bc5e0264d3ed0f2c9129fa69fc167"
SOURCE_FILENAME="markupsafe-$portVersion.tag.gz"
SOURCE_DIR="markupsafe-$portVersion"

ARCHITECTURES="all ?x86"

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

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc
	"
PYTHON_PACKAGES=(python python3 python38 python39)
PYTHON_VERSIONS=(2.7 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\
	\"; \
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]}

		# GENERIC: all python_setuptools-based installs need this
		python=python$pythonVersion
		pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3)
		installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
		export PYTHONPATH=$installLocation:$PYTHONPATH
		mkdir -p $installLocation
		rm -rf build
		$python setup.py install \
			--root=/ --prefix=$prefix

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