SUMMARY="Filesystem events monitoring"
DESCRIPTION="Python API and shell utilities to monitor file system events."
HOMEPAGE="https://pypi.python.org/pypi/watchdog"
COPYRIGHT="2011 Yesudeep Mangalapilly
	2012 Google, Inc."
LICENSE="Apache v2"
REVISION="3"
SOURCE_URI="https://pypi.python.org/packages/source/w/watchdog/watchdog-$portVersion.tar.gz"
CHECKSUM_SHA256="965f658d0732de3188211932aeb0bb457587f04f63ab4c1e33eab878e9de961d"

ARCHITECTURES="any"

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\n\
	argh_$pythonPackage\n\
	pathtools_$pythonPackage\n\
	pyyaml_$pythonPackage\n\
	\""
BUILD_REQUIRES="$BUILD_REQUIRES
	setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	cmd:python$pythonVersion"
done

PROVIDES_python="$PROVIDES_python
	cmd:watchmedo = $portVersion
	"
PROVIDES_python3="$PROVIDES_python3
	cmd:watchmedo3.7 = $portVersion
	"
PROVIDES_python38="$PROVIDES_python38
	cmd:watchmedo3.8 = $portVersion
	"
PROVIDES_python39="$PROVIDES_python39
	cmd:watchmedo3.9 = $portVersion
	"
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 build install \
			--root=/ --prefix=$prefix

		if [ $pythonPackage != python ]; then
			mv $binDir/watchmedo $binDir/watchmedo$pythonVersion
		fi
		packageEntries  $pythonPackage \
			$prefix/lib/python* \
			$binDir
	done
}
