SUMMARY="Parses CSS3 Selectors and translates them to XPath 1.0"
DESCRIPTION="cssselect parses CSS3 Selectors and translate them to XPath 1.0 \
expressions. Such expressions can be used in lxml or another XPath \
engine to find the matching elements in an XML or HTML document."
HOMEPAGE="https://pythonhosted.org/cssselect/
	https://pypi.python.org/pypi/cssselect"
COPYRIGHT="2007-2019 Ian Bicking and contributors"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/scrapy/cssselect/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="dde8c1d4a2c82de6889a3af1c1adbce1a6f3ec08b07a854d873f3f3da92960af"

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\
	\"; \
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

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