SUMMARY="Download, build, install, upgrade, and uninstall Python packages"
DESCRIPTION="EasyInstall (easy_install) gives you a quick and painless way \
to install packages remotely by connecting to the cheeseshop or even other \
websites via HTTP. It is somewhat analogous to the CPAN and PEAR tools for \
Perl and PHP, respectively."
HOMEPAGE="https://pypi.python.org/pypi/setuptools"
COPYRIGHT="2006-2014 Python Packaging Authority"
LICENSE="Python"
REVISION="2"
SOURCE_URI="https://pypi.python.org/packages/source/s/setuptools/setuptools-5.3.zip"
CHECKSUM_SHA256="238142293c36d2b56c83df1886b4c1fc4af77d0c203c68b8f4e57d8995babfe5"
SOURCE_DIR="setuptools-$portVersion"

ARCHITECTURES="x86 x86_gcc2 x86_64"

PROVIDES="
	python_setuptools = $portVersion
	"
REQUIRES="
	haiku
	cmd:python
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:python
	cmd:sed
	"

BUILD()
{
	$portPackageLinksDir/cmd~python/bin/python setup.py build
}

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

	# easy_install cannot tolerate not being installed alongside setuptools,
	# so just delete it.
	rm $prefix/bin/easy_install
	rm $prefix/bin/easy_install-2.?
}
